Bash has elegant and powerful constructs like `mapfile',
yet it is missing something as easy as an array "pop".

Extract the last value of an array at the same time as
removing it from the array.

Is this the best one can do?

$ a=(1 2 3); v=${a[-1]}; unset 'a[-1]'; printf '%s\n' "$v" "${a[@]}"

The 2-step approach gets tiresome after a while.

For positional parameters, it _does_ have `shift'...
... maybe it could add a `pop`, somehow?

Reply via email to