当前位置:网站首页># bash 的 try catch
# bash 的 try catch
2022-06-21 17:09:00 【云归而-暝】
最近写了下shell. 深感if else 繁琐。参考了下csdn某位博主。结果代码没用。于是我自己写了个模板。等我写博文时翻到他引用的stackoverflow链接时才发现。他少了&& 。 :)
我的模板
:
(
:
## 要加代码时把:去掉。
) || {
case $? in
*)
perror $?
;;
esac
}
stackoverflow模板
# set -e
{
# try
command1 &&
#save your output
} || {
# catch
# save log for exception
}
边栏推荐
- 使用jmeter做Web端自动化测试
- 2022年高处安装、维护、拆除上岗证题库及模拟考试
- ByteDance proposes a lightweight and efficient new network mocovit, which has better performance than GhostNet and mobilenetv3 in CV tasks such as classification and detection!
- Typescript object type
- 7. space removal function -strip
- 国产API管理平台横向比较,到底哪家强?
- A new generation of stability testing tool fastbot
- 雷军的千亿失误?
- Canvas球体粒子变幻颜色js特效
- Typescript接口
猜你喜欢

JSON parsing of node

Day14QProgressBar2021-10-17

ByteDance proposes a lightweight and efficient new network mocovit, which has better performance than GhostNet and mobilenetv3 in CV tasks such as classification and detection!

8. get directory function / get file function -dir / -notdir

2022年R1快开门式压力容器操作操作证考试题库模拟考试平台操作

Node输出方式

Character processing of node

Disclose the design idea of MVVM framework supporting Baidu search, feed and applet, and San core personnel have made great efforts to build it

雷军的千亿失误?

Canvas动态网状背景js特效
随机推荐
Metagenome (personal notes)
带你区分几种并行
剑指Offer 56. 删除链表的重复节点
TypeScript的类型检查
【微服务|Nacos】快速实现nacos的配置中心功能,并完成配置更新和版本迭代
启动!阿里巴巴编程之夏2022
With mitmdump, don't throw it away, Charles
缓存型数据库Redis的配置与优化
In the new season, China Super League and Guoan are moving forward amid thorns
大学物理第9章·振动
TS的基本数据类型和结构数据类型
The best network packet capturing tool mitmproxy
剑指 Offer 12. 矩阵中的路径
2022年R1快开门式压力容器操作操作证考试题库模拟考试平台操作
力扣295. 数据流的中位数
Markdown writing software: Ulysses v27
Vue.js+Node.js全栈开发教程:连接MySQL
Typescript object type
Stata quick check backup (personal notes)
8. get directory function / get file function -dir / -notdir