Re: Shell function.
On Thu, May 15, 2025 at 12:00 PM peter wrote:
>
> Hi,
>
> Given this function.
>
> ev () { case $# in
> 0) /usr/bin/evince --display=:0 ;;
> 1) /usr/bin/evince --display=:0 $1 ;;
> *) echo "Too many arguments." ;; esac }
>
> Can improvements be suggested?
quoting $1
I don't know about evince, but what happens if someone gives you a
parameter with embedded spaces or control characters?
$ ./args "foo bar baz" 2 3 4
4 args:
arg: <foo bar baz>
arg: <2>
arg: <3>
arg: <4>
Regards
Lee
Reply to: