[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: distinguishing shells
# How about
# @ {} || echo this is sh
Unfortunately that generates an error message from sh since it cannot
find a command named '@'. The only thing I can think of that runs in
both without syntax errors is something like
test "" '=' '' && {
echo NOT rc or es
} || {
echo rc or es
}
but that does require using 'test'.
If you've already defined an rc or es function named ':' which returns
false, then it's easy:
: && {
echo NOT rc or es
} || {
echo rc or es
}
But I think this is worse than using 'test'.
sh-like syntax and rc-like syntax are so different that I doubt there
is enough in common to allow distinguising between the two without
resorting to an external command. I would love to be proven wrong
about this.
DaviD W. Sanderson dws@ssec.wisc.edu
Space Science and Engineering Center University of Wisconsin-Madison
"The Noah Webster of smileys" - The Wall Street Journal, 15 Sep 1992