Shell Symbols

$#csh, sh Number of arguments to script
$*csh, sh Arguments to script
$@sh Original arguments to script
$-sh Flags passed to shell
${array[@]} leads to each element of the array being treated as a separate shell-word
${array[*]} results in a single shell-word with all of the elements of the array separated by spaces (or whatever the first character of IFS is)

Difference between $@ and $*

$@

./test_shell "w1 w2" w3 w4

$@ will be
w1 w2
w3
w4

$*
./test_shell "w1 w2" w3 w4

$* will be
w1 w2 w3 w4

评论

此博客中的热门博文

Configure shadowsocks transparent proxy + gfwlist(PAC) on OpenWRT Router

Openwrt路由器上配置shadowsocks透明代理+gfwlist(PAC)

Configure V2Ray(Shadowsocks mode) + 加速:普通BBR/魔改BBR on KVM VPS (Tested on Ubuntu 16.04)