Package: dash
Version: 0.5.7-4
Severity: normal

--- Please enter the report below this line. ---

Hi.

dash seems to abort the following script, when reaching the expected
error when the shift command has nothing more to shift and fails.

============
#!/bin/sh

# just output all parameters
echo $1
while shift; do
        echo $1
done

echo "done"
============

It never reaches the echo "done" part, which it should in my eyes. bash
behaves differently (and IMHO correctly) in this case and reaches the
end of the script.

Additionally an error string is output from dash, which is probably not
needed but documented that way in the manpage.

This is a run with dash (echo "done" is not reached):
$ ./shifttest.sh 1 2 3 4
1
2
3
4

./shifttest.sh: 4: shift: can't shift that many
$

This is a run with bash:
$ ./shifttest.sh 1 2 3 4
1
2
3
4

done
$

The problem seems only to happen when shift is tested. Other things,
like checking for the existence of a file, do not trigger an immediate exit.

Regards
  Andre

--- System information. ---
Architecture: amd64
Kernel:       Linux 3.14-1-amd64

Debian Release: jessie/sid
  500 unstable        ftp.de.debian.org
  500 unstable        ftp-stud.hs-esslingen.de

--- Package information. ---
Depends           (Version) | Installed
===========================-+-============
debianutils       (>= 2.15) | 4.4
dpkg            (>= 1.15.0) | 1.17.10


Package's Recommends field is empty.

Package's Suggests field is empty.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to