当前位置:网站首页>Shell脚本(.sh文件)如何执行完毕之后不自动关闭、闪退?
Shell脚本(.sh文件)如何执行完毕之后不自动关闭、闪退?
2022-06-24 09:54:00 【Dust_Evc】
Shell脚本异常傲娇,出错后、执行完根本不给你机会让你查看报错信息、输出信息,直接闪退。
废话不多说,调教方法如下,直接在Shell脚本末尾加上如下代码:
# 使用read命令达到类似bat中的pause命令效果
echo 按任意键继续
read -n 1
echo 继续运行例:
某.sh文件内容如下图,执行完或出错后直接闪退。

末尾加上代码:

这样,运行出错后、执行完,可以有足够的时间来查看报错信息、输出信息。按任意键关闭窗口或者点击关闭窗口。

另外,利用sleep命令实现窗口延迟关闭以及其他例子可参考:
边栏推荐
- Introduction to the use of splice() method
- 88. merge ordered arrays
- [JS reverse sharing] community information of a website
- [Flink source code practice (I)] add a rest API to Flink
- Apple's legendary design team disbanded after jobs refused to obey cook
- What is recursion?
- Plant growth H5 animation JS special effect
- Svg+js drag slider round progress bar
- [net action!] Cos data escort helps SMEs avoid content security risks!
- How to open a video number?
猜你喜欢

【毕业季·进击的技术er】绕树三匝,何枝可依?

Hbuilder makes hero skin lottery games

Moving Tencent to the cloud cured their technical anxiety

Charles packet capturing tool tutorial

Cool interactive animation JS special effects implemented by p5.js

程序员大部分时间不是写代码,而是。。。

服乔布斯不服库克,苹果传奇设计团队解散内幕曝光

Canvas pipe animation JS special effect

Canvas infinite scan JS special effect code
![[data analysis data source] coordinates of provinces, cities and administrative regions across the country (including boundary coordinate points and central coordinate points)](/img/a8/84088b1e61deaf62f22d85a007423b.png)
[data analysis data source] coordinates of provinces, cities and administrative regions across the country (including boundary coordinate points and central coordinate points)
随机推荐
Tencent's open source project "Yinglong" has become a top-level project of Apache: the former long-term service wechat payment can hold a million billion level of data stream processing
The nodejs service global timeout callback failed to get process Domain problem
Hbuilder makes hero skin lottery games
[activities this Saturday] NET Day in China
Fashionable pop-up mode login registration window
如何只导出word文档中的标题?(即将正文内容都删除,只保留标题)B站牛逼
Group counting_ Structure and workflow of CPU
Beauty of script │ VBS introduction interactive practice
Anonymous Messenger: hidden communication of Trojan horse
Investing in a good navigation framework from the beginning of the jetpack compose tutorial will help you save a lot of migration work later
23. opencv - image mosaic project
Any and typevar make the automatic completion of IDE better
How to convert an array to an object, and how to convert an object to an array
How to export only the titles in word documents? (i.e. delete all the text contents and keep only the title) stop B
Self service troubleshooting guide for redis connection login problems
Cloud vendor secondary virtualization restrictions
The record of 1300+ times of listing and the pursuit of ultimate happiness
H5 video conference, camera monitoring, web streaming and live broadcast integration scheme
2008R2 precautions for configuring L2TP pre shared key VPN
今日睡眠质量记录76分