-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 21.04.2017 um 14:56 schrieb Will Furnass:

> Hi all,
> 
> I want to switch from using qrsh directly to using a wrapper ('qrshx')
> that gives me a session in which all the env vars set in qsub/qsh
> sessions (e.g. JOB_ID) are defined:
> 
> $ cat /usr/local/scripts/qrshx
> #!/bin/sh
> # ...
> exec qrsh $( [ -z ${DISPLAY+x} ] || echo '-v DISPLAY' ) -pty y "$@" $SHELL

Outside of the SGE scope, but I tried to invert the logic for curiosity, i.e. [ 
-n ${DISPLAY+x} ] && … which didn't work at first. It turned out, that 
${DISPLAY+x} has to be put in quotation marks in both cases to work as 
expected. The reason behind this is, that without them ${DISPLAY+x} might just 
return nothing (not even an empty string) and essentially [ -z ] resp. [ -n ] 
stands alone. With only one argument given the [ command doesn't treat -z / -n 
as an unary conditional operator any longer but as a valid string, which is 
true in both cases.

- -- Reuti

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iEYEARECAAYFAlj7bwwACgkQo/GbGkBRnRqbfACfXMqRpm9/kGTMO8Tr59OC+4EQ
u1cAn1vC5JzjvHbUA7klkVbRkddGn55p
=oxUA
-----END PGP SIGNATURE-----
_______________________________________________
SGE-discuss mailing list
[email protected]
https://arc.liv.ac.uk/mailman/listinfo/sge-discuss

Reply via email to