On Mon, Apr 15, 2019 at 08:42:53AM -0400, Greg Wooledge wrote: > On Sat, Apr 13, 2019 at 09:43:47AM +0200, Toralf Förster wrote: > > Except, that I used the opposite: > > > > min_days=${1:-5} > > min_hours=${2:-12} > > min_compl=${3:-3500} > > shift "$(( $# < 3 ? $# : 3 ))" > > setupargs="$@" > > So... this user interface of yours. It looks something like > > myprog [days] [hours] [compl] [file ...] > > So if the user passes two numeric arguments and then a filename, the > third filename becomes "compl" (whatever that is, but it seems to be > numeric)? > > If the user passes two numeric arguments and then 17 filenames, the > first filename becomes "compl" and gets shifted away, and then only > the last 16 filenames are processed? > > I'm seeing a whole lot of pitfall here and not much safety net.
Also, you are squashing all of your filename arguments down into a single string variable, presumably to be word-split later. Which will blow up when one of those arguments contains whitespace or glob characters. If you want to store a list of arguments, use an array variable instead of a string variable.