On Sat, Apr 13, 2019, 9:43 AM Robert Elz <k...@munnari.oz.au> wrote: > Date: Thu, 11 Apr 2019 19:05:56 -0400 > From: Chet Ramey <chet.ra...@case.edu> > Message-ID: <6973cbca-28bd-5a20-4966-1d8251e95...@case.edu> > > | If you want to be sure to shift out all existing parameters, use > | `shift $#'. If you want something else, you can add logic to cap the > | argument passed to `shift' at $#. > > I agree. > > Except "set --" is less work all around than "shift $#" > > In general: > > [ "$ARG" -lt "$#" ] && shift "$ARG" || set --
shift "$(( n < $# ? n : $# ))" -- konsolebox