typeset -Z4 curtime command is giving different result than expected inside scripts in linux.But it gives expected results outside the scripts.Can you please help us
---------- Post updated at 05:37 AM ---------- Previous update was at 05:25 AM ----------
What symptoms do you have? I have pasted your code into AIX and RedHat Linux without issue, but then I have my shell set as ksh. Doing it in bash gives me the following:-
I've changed the typeset to set a 4 character field padded with leading zeros, because I was running this at 09:25 local time to me, so the output I got was just 925 . On both AIX and RHEL, I am using ksh, but if I swap to bash (the default for RHEL) then I get the following output using typeset -i :-
bash: 0928: value too great for base (error token is "0928")
The -Z flag for typeset is not valid for bash. I've not needed it yet, but it would be good to know of a way to acheive the same effect. When forcing it in, I get:-