原文链接:http://codingstandards.iteye.com/blog/836625 (转载请注明出处) 用途说明 exit命令用于退出当前shell,在shell脚本中可以终止当前脚本执行. 常用参数 格式:exit n 退出.设置退出码为n.(Cause the shell to exit with a status of n.) 格式:exit 退出.退出码不变,即为最后一个命令的退出码.(If n is omitted, the exit status is that…
前言 只是作为一个shell的小小练习和日常统计用,瞎折腾的过程中也是摸到了获取子shell返回值的几种方法: 肯定还有别的方法,跟进程间的通信相关,希望你能提出建议和补充,谢谢~ 完整程序: #! /bin/bash #检查参数数量是否符合要求 if [ $# -ne 1 ] then echo How to use: $0 ---> basepath! exit -1 fi #获取传入的路径参数 path=$1 #声明一个关联数组 declare -A typearray while rea…
本文链接:http://codingstandards.iteye.com/blog/836625 (转载请注明出处) 用途说明 exit命令用于退出当前shell,在shell脚本中可以终止当前脚本执行. 常用参数 格式:exit n 退出.设置退出码为n.(Cause the shell to exit with a status of n.) 格式:exit 退出.退出码不变,即为最后一个命令的退出码.(If n is omitted, the exit status is that…