Why does the following command not work withing stdin?
printf "%s\n" "${BASH_VERSINFO[0]}"
stderr message:
-/bin/bash: line 5: ${BASH_VERSINFO[0]}: bad substitution
If i place the same command in an executable file on the linux box and then execute the file from stdin, the printf will work.
I'm also seeing a similiar behavior for array proccessing. My first approach was to place most of my bash processing in stdin. but now i've moved it down to the local script and invoke it from stdin.
Why some commands do not work from stdin?
The only difference that I can imagine between running bash interactively on z/OS vs via COZBATCH is that, under COZBATCH, there isn't a "tty", but this really doesn't explain the problem that you are seeing.
So, in effect, what COZBATCH is doing is somthing like:
/bin/bash -l < dd:stding > dd:stdout 2>dd:stderr
Also, you might try inserting an "env" command at the beginning of your script. Is "LANG=C" set? I'm just wondering if there is something odd that prevents bracket characters from being recognized properly. Maybe you can double check (using "hex on") on ISPF what values you are using for brackets - perhaps it is a problem with your TN3270 emulator codepage? This would explain why brackets work in a Unix file if the bracket characters are a different code point there.
So, in effect, what COZBATCH is doing is somthing like:
/bin/bash -l < dd:stding > dd:stdout 2>dd:stderr
Also, you might try inserting an "env" command at the beginning of your script. Is "LANG=C" set? I'm just wondering if there is something odd that prevents bracket characters from being recognized properly. Maybe you can double check (using "hex on") on ISPF what values you are using for brackets - perhaps it is a problem with your TN3270 emulator codepage? This would explain why brackets work in a Unix file if the bracket characters are a different code point there.