Hi,
On one of my systems, this job:
//BPX EXEC PGM=BPXBATCH,REGION=0M
//STDERR DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDENV DD *
//STDPARM DD *
SH bash -c '
uname -a
&& TMPDIR=Å(mktemp -d)
&& cd ÅTMPDIR
&& chgrp Å(id -g) .
&& git clone -b feature/TEST
ssh://gitØgitprod:7999/vpzt/vpztools.git
&& cd vpztools
&& echo ZZZaaa
&& cat vpztools/build/build-bash.sh
&& echo ZZZbbb
&& vpztools/build/build-bash.sh
&& echo ZZZccc
&& cat vpztools/build/build-sh.sh
&& echo ZZZddd
&& vpztools/build/build-sh.sh
&& cd /tmp
&& rm -rf ÅTMPDIR
!! exit 1
'
Gives me this outout:
OS/390 MVS2 27.00 04 2964
ZZZaaa
Ƥ/bin/bash
echo aaa
git rev-parse --abbrev-ref HEAD
echo bbb
git rev-parse --abbrev-ref HEAD ! sed 's+/+_+g'
echo ccc
ZZZbbb
aaa
feature/TEST
bbb
feature_TEST
ccc
ZZZccc
Ƥ/bin/sh
echo aaa
git rev-parse --abbrev-ref HEAD
echo bbb
git rev-parse --abbrev-ref HEAD ! sed 's+/+_+g'
echo ccc
ZZZddd
aaa
feature/TEST
bbb
£] aã$âã ccc
See the very last line of output.
The only diff in the two scripts is the first line: "/bin/bash" is fine, "/bin/sh" gives garbage output.
Anyone has an idea?
/Morten
------------------------------
Morten Kjærulff
Self Registered
København S DK
------------------------------
Page 1 / 1
Hi,
On one of my systems, this job:
//BPX EXEC PGM=BPXBATCH,REGION=0M
//STDERR DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDENV DD *
//STDPARM DD *
SH bash -c '
uname -a
&& TMPDIR=Å(mktemp -d)
&& cd ÅTMPDIR
&& chgrp Å(id -g) .
&& git clone -b feature/TEST
ssh://gitØgitprod:7999/vpzt/vpztools.git
&& cd vpztools
&& echo ZZZaaa
&& cat vpztools/build/build-bash.sh
&& echo ZZZbbb
&& vpztools/build/build-bash.sh
&& echo ZZZccc
&& cat vpztools/build/build-sh.sh
&& echo ZZZddd
&& vpztools/build/build-sh.sh
&& cd /tmp
&& rm -rf ÅTMPDIR
!! exit 1
'
Gives me this outout:
OS/390 MVS2 27.00 04 2964
ZZZaaa
Ƥ/bin/bash
echo aaa
git rev-parse --abbrev-ref HEAD
echo bbb
git rev-parse --abbrev-ref HEAD ! sed 's+/+_+g'
echo ccc
ZZZbbb
aaa
feature/TEST
bbb
feature_TEST
ccc
ZZZccc
Ƥ/bin/sh
echo aaa
git rev-parse --abbrev-ref HEAD
echo bbb
git rev-parse --abbrev-ref HEAD ! sed 's+/+_+g'
echo ccc
ZZZddd
aaa
feature/TEST
bbb
£] aã$âã ccc
See the very last line of output.
The only diff in the two scripts is the first line: "/bin/bash" is fine, "/bin/sh" gives garbage output.
Anyone has an idea?
/Morten
------------------------------
Morten Kjærulff
Self Registered
København S DK
------------------------------
On one of my systems, this job:
//BPX EXEC PGM=BPXBATCH,REGION=0M
//STDERR DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDENV DD *
//STDPARM DD *
SH bash -c '
uname -a
&& TMPDIR=Å(mktemp -d)
&& cd ÅTMPDIR
&& chgrp Å(id -g) .
&& git clone -b feature/TEST
ssh://gitØgitprod:7999/vpzt/vpztools.git
&& cd vpztools
&& echo ZZZaaa
&& cat vpztools/build/build-bash.sh
&& echo ZZZbbb
&& vpztools/build/build-bash.sh
&& echo ZZZccc
&& cat vpztools/build/build-sh.sh
&& echo ZZZddd
&& vpztools/build/build-sh.sh
&& cd /tmp
&& rm -rf ÅTMPDIR
!! exit 1
'
Gives me this outout:
OS/390 MVS2 27.00 04 2964
ZZZaaa
Ƥ/bin/bash
echo aaa
git rev-parse --abbrev-ref HEAD
echo bbb
git rev-parse --abbrev-ref HEAD ! sed 's+/+_+g'
echo ccc
ZZZbbb
aaa
feature/TEST
bbb
feature_TEST
ccc
ZZZccc
Ƥ/bin/sh
echo aaa
git rev-parse --abbrev-ref HEAD
echo bbb
git rev-parse --abbrev-ref HEAD ! sed 's+/+_+g'
echo ccc
ZZZddd
aaa
feature/TEST
bbb
£] aã$âã ccc
See the very last line of output.
The only diff in the two scripts is the first line: "/bin/bash" is fine, "/bin/sh" gives garbage output.
Anyone has an idea?
/Morten
------------------------------
Morten Kjærulff
Self Registered
København S DK
------------------------------
The shebang at the beginning of the script (those
#!/bin/bash and #!/bin/sh lines) tells the shell which program should process the file. In your case, even though the shebang #!/bin/bash is not quite correct (unless you really have bash in /bin), it still causes the first script to be executed in bash (because of bash -c). The second script is executed in sh.Now, for our ported tools to work correctly, automatic character conversion should be set up using the following environment variables:
export _BPXK_AUTOCVT=ON
export _CEE_RUNOPTS='FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)'
export _TAG_REDIR_IN=txt
export _TAG_REDIR_OUT=txt
export _TAG_REDIR_ERR=txt
Without these variables, many tools will produce garbage in
/bin/sh because text output or input is not converted properly between ASCII and EBCDIC. Bash configures standard streams (stdin/stdout) a bit differently from sh, and can sometimes produce readable output when the conversion variables are not configured. Nevertheless the above environment variables are required for our tools to work correctly, so it is highly recommended that you add those exports if you don't have them already.Regards,
Vladimir
------------------------------
Vladimir Ein
Software Engineer
Rocket Software
------------------------------
Hi Morten,
The shebang at the beginning of the script (those
Now, for our ported tools to work correctly, automatic character conversion should be set up using the following environment variables:
Without these variables, many tools will produce garbage in
Regards,
Vladimir
------------------------------
Vladimir Ein
Software Engineer
Rocket Software
------------------------------
The shebang at the beginning of the script (those
#!/bin/bash and #!/bin/sh lines) tells the shell which program should process the file. In your case, even though the shebang #!/bin/bash is not quite correct (unless you really have bash in /bin), it still causes the first script to be executed in bash (because of bash -c). The second script is executed in sh.Now, for our ported tools to work correctly, automatic character conversion should be set up using the following environment variables:
export _BPXK_AUTOCVT=ON
export _CEE_RUNOPTS='FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)'
export _TAG_REDIR_IN=txt
export _TAG_REDIR_OUT=txt
export _TAG_REDIR_ERR=txt
Without these variables, many tools will produce garbage in
/bin/sh because text output or input is not converted properly between ASCII and EBCDIC. Bash configures standard streams (stdin/stdout) a bit differently from sh, and can sometimes produce readable output when the conversion variables are not configured. Nevertheless the above environment variables are required for our tools to work correctly, so it is highly recommended that you add those exports if you don't have them already.Regards,
Vladimir
------------------------------
Vladimir Ein
Software Engineer
Rocket Software
------------------------------
I was missing:
export _TAG_REDIR_IN=txtI added and it works now.
export _TAG_REDIR_OUT=txt
export _TAG_REDIR_ERR=txt
The strange part is that it was only on one of my systems that I saw the error.
I have been wondering why #!/bin/bash was actually working, but you also explained that. What would be the correct shebang, if /bin/bash does not exist (only in PATH)?
/Morten
------------------------------
Morten Kjærulff
Self Registered
København S DK
------------------------------
Thanks!
I was missing:
The strange part is that it was only on one of my systems that I saw the error.
I have been wondering why #!/bin/bash was actually working, but you also explained that. What would be the correct shebang, if /bin/bash does not exist (only in PATH)?
/Morten
------------------------------
Morten Kjærulff
Self Registered
København S DK
------------------------------
I was missing:
export _TAG_REDIR_IN=txtI added and it works now.
export _TAG_REDIR_OUT=txt
export _TAG_REDIR_ERR=txt
The strange part is that it was only on one of my systems that I saw the error.
I have been wondering why #!/bin/bash was actually working, but you also explained that. What would be the correct shebang, if /bin/bash does not exist (only in PATH)?
/Morten
------------------------------
Morten Kjærulff
Self Registered
København S DK
------------------------------
The #! should refer to where the bash executable is. You can find this easily with the type command ie. type bash
------------------------------
Adam Martin Britt
IT-Architect
BEC
Randers SV DK
------------------------------
Thanks!
I was missing:
The strange part is that it was only on one of my systems that I saw the error.
I have been wondering why #!/bin/bash was actually working, but you also explained that. What would be the correct shebang, if /bin/bash does not exist (only in PATH)?
/Morten
------------------------------
Morten Kjærulff
Self Registered
København S DK
------------------------------
I was missing:
export _TAG_REDIR_IN=txtI added and it works now.
export _TAG_REDIR_OUT=txt
export _TAG_REDIR_ERR=txt
The strange part is that it was only on one of my systems that I saw the error.
I have been wondering why #!/bin/bash was actually working, but you also explained that. What would be the correct shebang, if /bin/bash does not exist (only in PATH)?
/Morten
------------------------------
Morten Kjærulff
Self Registered
København S DK
------------------------------
#!/bin/env bash
Alternatively, if you always have bash at a certain path, and are sure it won't eventually disappear from there, you can put that path directly into the shebang line, as Adam has pointed out. This will be specific to your system, but it will also be 'protected' from $PATH changes (sometimes it might be desirable, sometimes not).
Regards,
Vladimir
------------------------------
Vladimir Ein
Software Engineer
Rocket Software
------------------------------
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.