Shell系列(2)- 脚本执行方式
2023-02-18 16:27:22 时间
创建shell脚本
【root@localhost sh】# vim hello.sh shell脚本必须用.sh,同时方便文件管理
#!/bin/bash:shell文件第一行必须是这个,声明这个文件是shell文件;在Linux中#是注释的意思,但是第一行#是声明的作用
shell脚本执行
赋予shell文件执行权限,直接运行,最常用
- chmod 755 hello.sh:赋予该文件所有者755权限
- ./hello.sh:使用绝对路径或者相对路径直接运行
通过Bash调用执行脚本
- bash hello.sh:bash执行时不需要shell文件赋予权限,直接运行
相关文章
- 安卓项目五子棋代码详解(三)
- 安卓项目五子棋代码详解(二)
- 安卓项目五子棋代码详解(一)
- 3xx HTTP状态码的终极指南
- React报错之React.Children.only expected to receive single React element child
- React报错之Element type is invalid
- React报错之Too many re-renders
- React报错之Function components cannot have string refs
- 如何发布一个 TypeScript 编写的 npm 包
- 如何使用zx编写shell脚本
- 13个构建RESTful API的最佳实践
- 什么是REST API
- React报错之Rendered more hooks than during the previous render
- 如何使用CSS伪类选择器
- React报错之Property 'value' does not exist on type EventTarget
- React报错之Parameter 'event' implicitly has an 'any' type
- React报错之Parameter 'props' implicitly has an 'any' type
- React报错之Property 'value' does not exist on type 'HTMLElement'
- React报错之You provided a `checked` prop to a form field
- React报错之Invalid hook call