OPTIND

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




  According to both the dash man page and the POSIX spec, "When the
  shell is invoked, OPTIND is initialized to 1."

  However, it actually takes the value of the environment variable
  if it exists:

$ OPTIND=4 dash -c 'echo "$OPTIND"'
4
$ OPTIND=4 bash -c 'echo "$OPTIND"'
1
$ OPTIND=4 ksh -c 'echo "$OPTIND"'
1
$ OPTIND=4 ksh93 -c 'echo "$OPTIND"'
1

--
   Chris F.A. Johnson, <http://cfajohnson.com/>
   Author:
   Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux