Too often I end up having to write something like
if (($#)); then <func|exec> "$@"
else <func|exec>      #<func|exec> = function or executable call
fi

It would be nice to have a expansion that preserves arg boundaries
but that expands to nothing when there are 0 parameters
(because whatever gets called still sees "" as a parameter)

So, example, something like:

$~ == "$@" #for 1 or more params
$~ ==  no param when 0 param, # so for the above if/else/endif
one could just use 1 line:

  <func|exec> $~

My examples used ~, as I didn't think it was used anywhere.

I can't control how called programs will handle / deal with a
present, but empty parameter, which is why I thought something that
expands to nothing in the empty case would seem ideal.

Anyone else have a trivial solution for this problem?



Reply via email to