7
1
The following script works fine in one of my machines, printing 1
then 2
:
#!/bin/sh
echo "1"
shift
echo "2"
On another machine, however, it produces the following output:
1
./script.sh: 4: shift: can't shift that many
man shift
does not help (No manual entry for shift
).
What is that error, why is it happening, and how can I fix it?
Just stumbled across this when I had the same problem. Thanks for posting this Q&A! You can also accept your own answer (that's considered perfectly acceptable, ba-dum-tss). (There's a two-day delay before you can accept your own answer, but I think it's safe to say that's elapsed by now.) ;) – n.st – 2018-12-08T14:27:23.477