At my current job I am having to learn and interact a lot with Korn Shell
I was having a strange issue that I just learned is related to the differences of Bash and Ksh. Bellow you will see the difference in the output of this command. With bash I get a json, dictionary like output with Curly Braces in the beginning and end. With Ksh the Curly Braces are not present in the echo command and that breaks my code later on, as I'm expecting a json to be parsed.
This behavior is consistent to what I'm getting in my next file, where I can't parse the json.
token.sh
access_token_response=$(curl -i -k --tlsv1.2 -X POST https://api.cloud.com/oauth2/token -d client_id=id -d client_secret=secret -d grant_type=client_credentials)
echo $access_token_response
Outputs
$ bash token.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 643 0 516 100 127 23329 5741 --:--:-- --:--:-- --:--:-- 30619
{"issued_at":1654531548,"access_token":"eyJlbmMiO5yrqw","expires_in":1296000,"token_type":"Bearer"}
$ ksh token.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 643 0 516 100 127 19549 4811 --:--:-- --:--:-- --:--:-- 24730
"issued_at":1654531553 "access_token":"eyJlwMFlKCv7KjEw" "expires_in":1296000 "token_type":"Bearer"
[awsgfedsbtch@ip-204-56-124 shell]$
I would love to get a solution for this issue, otherwise I may have to write some strange hacks to get over it.
But what I really want is some sort of guide on how to know and deal with this differences. I don't see that much material about Ksh around and knowing how to bridge the gap between the 2 shells would help me a lot in the long run.
Thanks!