[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
distinguishing shells
DaviD W Sanderson <dws@ssec.wisc.edu> asked for a way to differentiate between
rc/es and the other shells.
This works:
y=`echo`false;$y&&echo rc or es||echo sh
(it *does* expect there to be a false accessible to /bin/sh, but that
seems fairly likely, and it doesn't require anything for the rc side.)
In trying a few things, one of my ideas was to:
$SHELL -c '~ 5 5 2>/dev/null' && echo rc || echo sh
To my surprise, rc gave a syntax error because the ~ builtin doesn't
accept I/O redirection. (It actually doesn't work anyway because
/bin/sh complains about '~ not found' before the stderr redirect.)
../Dave
(I forwarded this to the rc list in case anyone there needed it too.)