On Fri, 04 Jul 2014 11:07:28 +0200 Andre Naujoks <naut...@gmail.com> wrote: > I just noticed Bug #627856, which deals with a very similar issue.
> Is a shift without an argument also considered a syntax error if it is > called too often? If yes, then this bug can be closed and I am sorry > for the noise. I'd say it's the same thing: "shift" is the same as "shift 1". > IMHO this should not be considered a syntax error, because it is > (again IMHO) a valid way of getting all arguments of a script or shell > function. Your code ] echo $1 ] while shift; do ] echo $1 ] done looks a bit strange. It only works properly if there is at least one argument to start with, and duplicates the handling for the first argument (although you can fix that by placing that piece of code directly after 'while'). It would be normal in Perl where 'shift' returns the value shifted out but the shell's 'shift' does not return that. It looks more normal to write code like: ] while [ "$#" -gt 0 ]; do ] echo $1 ] shift ] done or ] for arg do ] echo $arg ] done and then there is no issue with shift failing. -- Jilles Tjoelker -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org