Ever wanted $1 .. $9 to be more meaningful in a clean one-liner?
echo "$*" | ( read cmd tun_dev tun_mtu link_mtu ifconfig_local_ip ifconfig_remote_ip rest echo "the rest of your $cmd program and its arguments $link_mtu" echo "go here..." )
It would be great if one could just
echo "$@" | read a b c
but since the pipe forks the built-in shell command ‘read’, the variables $a, $b, $c are set in the sub-shell, not the shell you would want. The parenthesis force a subshell for your operation, and while its not pretty, it works quite well!
Also, thanks to Uwe Waldmann for his great Bash/sh/ksh quoting guide.
Cheers,
-Eric