exit 和 return
来源:互联网 发布:淘宝买药品要提交需求 编辑:程序博客网 时间:2024/05/21 10:10
exit [n] Cause the shell to exit with a status of n. If n is omitted, the exit status is that of the last command executed. A trap on EXIT is executed before the shell ter-minates.设置shell 退出时候的状态码,如果n 没有设置,退出状态是上次执行命令[oracle@june3 dbi]$ cat a1.sh exit 10;[oracle@june3 dbi]$ sh ./a1.sh[oracle@june3 dbi]$ echo $?10[oracle@june3 dbi]$ cat a2.shaaaexit ;[oracle@june3 dbi]$ sh ./a2.sh./a2.sh: line 1: aaa: command not found[oracle@june3 dbi]$ echo $?127If neither option is supplied and an error occurred or command cannot be found, the exit status is 127rerurn 函数:return: can only `return' from a function or sourced script[oracle@june3 dbi]$ cat a4.sh fun() {lsreturn 100}fun[oracle@june3 dbi]$ sh ./a4.sh1 1.pl 2.pl 3.pl 4.pl 5.pl a1.sha2.sh a3.sh a4.sh aa[oracle@june3 dbi]$ echo $?100[oracle@june3 dbi]$ cat a4.sh fun() {ls#return 100}fun[oracle@june3 dbi]$ sh ./a4.sh1 1.pl 2.pl 3.pl 4.pl 5.pl a1.sha2.sh a3.sh a4.sh aa[oracle@june3 dbi]$ echo $?0return 用户返回函数执行的值
0 0
- return 和exit
- exit和return区别
- exit和return
- exit和return
- exit()和return
- 关于exit() 和 return ()
- exit和return区别
- return 和 exit
- exit 和 return
- return和exit
- return和exit
- return和exit()
- exit和return
- Exit()和return
- exit()和_exit()和return
- Exit() 和 Return() 的区别
- exit函数和return函数
- exit()和return小析
- CentOS6.3安装
- java基础之反射
- ural 1018 Binary Apple Tree
- Hadoop 使用常见问题
- 黑马程序员——java多线程之死锁和等待唤醒机制
- exit 和 return
- python数据库函数的封装调用
- c++ 的(. ::)运算符
- CentOS 7 Linux系统管理员的命令行工具箱目录
- Linux下多线程查看工具(pstree、ps、pstack)
- 前端架构的技术储备需要想什么
- Windows快捷键
- 使用strace+pstack利器分析程序性能
- Unix路径“/”和“//”