Thread (5 messages) flat view 5 messages, 4 authors, 2016-06-15

Re: /bin/sh portability question

From: "H. Peter Anvin" <hpa@zytor.com>
Date: 2016-06-15 22:42:07

Peter Eriksen wrote:
2) In many of the shell scripts there is the idiom:

      #!/bin/sh
      
      cmd=
      path=$(dirname $0)
      case "$#" in
      0)      ;;
      *)      cmd="$1"
              shift
 
   When run, this gives the error:

      ./git.sh: syntax error at line 4: `path=$' unexpected

   I think it's because (on my Solaris at least), sh is really 
   sh and is not symlinked to bash, and sh doesn't like that 
   syntax.  Are there any good solutions to this other than
   making the administrators actually change sh to a symlink,
   (which I tried)?
I think $(foo) is required by POSIX.

	-hpa
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help