* Herbert Xu said: > > > > > Really? -e doesn't seem to be part of OSF/1 or Solaris. > > > > You can't implement all the standards. Most of the GNU software follows > > > > POSIX. Forget Solaris or OSF/1 and follow POSIX. > > > > > > So you mean POSIX mandates -e? > > AFAIK, yes - it is allowed, but left to the implementation. I might be wrong > > here, but I think it's allowed. > > Allowed is not the same as mandated. When you write scripts that are POSIX > compliant, you have to take into account *all* POSIX shells, not just the on > you've got. Otherwise you're writting shell scripts just for your own shell. True, but I have to KNOW wheter the feature is supported by the given product or not, right? How else can I adapt to different implementations? A standard that forbids (in effect) using its optional elements by not providing means to detect whether these are supported or not is broken and should be changed in that respect. How about: if [ -n "$POSIX_ECHO_ARG ]; then echo -n "Enter your name: " read NAME else read -p "Enter your name: " NAME fi The script is portable and can use optional features at will. Sure, takes more work, but the goal is achieved. marek
Attachment:
pgpAphEnySZL3.pgp
Description: PGP signature