共 3 篇文章 |
|
Bash shell中bash、sh、source及“.”点等五种执行方式的区别与联系。I am 28 this year.[Geeklp@Geeklp-BashShell ~]$ bash b.sh b.sh:行11: myName: 为绑定变量[Geeklp@Geeklp-BashShell ~]$ sh a.sh My name is Geeklp .I am 28 this year.[Geeklp@Geeklp-BashShell ~]$ sh b.sh b.sh:行11: myName: 为绑定变量。[Geeklp@Geeklp-BashShell ~... 阅82 转0 评0 公众公开 21-03-06 20:02 |
看下面这个比较复杂而真实的例子:forrest@forrest-laptop:~/study/shell/svn_tools$ tree .├── modules│ ├── log.sh│ ├── svn_core.sh│ └── utils.sh└── svncobranches.sh1 directory, 4 files依赖(导入)关系是:svncobranches.sh导入modules/svn_core.sh,svn_core.sh导入utils.sh和log.sh,log.sh导入utils.sh。 阅161 转0 评0 公众公开 20-10-26 23:10 |
do count=`expr $count + 1` done # 函数中使用return返回时,返回值的数据类型必须是数字 return $count}# 在$()的圆括号中可以执行linux命令,当然也包括执行函数res1=$(func1)# 变量res2将会接收函数的返回值,这里是3res2=`echo $?`if [[ $res2 == 3 ]]; then echo "func1() succeeded!"else echo "Not a right number!"... 阅32 转0 评0 公众公开 20-10-26 23:01 |