shell脚本的$@和$*

编程入门 行业动态 更新时间:2024-10-23 06:30:40

shell<a href=https://www.elefans.com/category/jswz/34/1771291.html style=脚本的$@和$*"/>

shell脚本的$@和$*

@ 和 @和 @和*的区别

#!/bin/bash# $@ and $* my_fun (){echo "$#"}echo 'the number of parameter in "$@"   is'    $(my_fun  "$@")
echo 'the number of parameter in "$*"     is'     $(my_fun  "$*")echo 'the number of parameter in $@      is'    $(my_fun  $@)
echo 'the number of parameter in $*        is'     $(my_fun  $*)
[lf@x201t ~]$ sh a.sh p1 "p2 p3" p4the number of parameter in "$@" is 3  
the number of parameter in "$*" is 1the number of parameter in $@ is 4
the number of parameter in $* is 4

看出区别了吗?关键 $@ 靠谱一点

更多推荐

shell脚本的$@和$*

本文发布于:2024-02-11 03:48:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1678965.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   shell

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!