~/ learn/ comp-325/ cards/ Positional parameters and shift
1 of 10

Reporting the arguments, then consuming one

Reporting the arguments, then consuming one

Answer

echo "name: $0" echo "count: $#" echo "all: $@" shift echo "count: $#" echo "first: $1"

Called with five arguments this prints 5, then 4 after the shift, and the first argument reported at the end is the one that used to be second. The one that used to be first cannot be recovered.

S&K 3e ch12 §12.4

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/f2ee05fb-40a0-409b-969b-13c775aac58c/flashcard utf-8 LF