linux shell执行方式
linux shell執行有兩種方式
shell腳本以#!/bin/bash開頭,執行shell時先檢查首行,在內部以下列方式執行:
$/bin/bash script.sh?
1. 使用sh執行。
? ?$sh script.sh #腳本位于當前目錄下
或者
? ?$sh /home/path/script.sh #使用完整路徑
2. 獨立運行腳本。
需要具備可執行權限,可以通過下面的方式設置
$chmod a+x script.sh
或者
$chmod 755 script.sh
然后可以通過下列方式執行:
$./script.sh #./表示當前目錄
或者
$ /home/path/script.sh #使用完整路徑
--------------------------------------------------------------------------------
附錄:chmod 命令
chmod?[-cfvR]?[--help]?[--version]?mode?file...
chmod owner group world FileName
● 4 – read (r)
● 2 – write (w)
● 1 – execute (x)
7 = 4+2+1 (read/write/execute)
6 = 4+2 (read/write)
5 = 4+1 (read/execute)
4 = 4 (read)
3 = 2+1 (write/execute)
2 = 2 (write)
1 = 1 (execute)
+?表示增加權限、-?表示取消權限、=?表示唯一設定權限
?
轉載于:https://www.cnblogs.com/davidwang456/p/3745093.html
總結
以上是生活随笔為你收集整理的linux shell执行方式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 理解OAuth 2.0--转
- 下一篇: oracle 查看表属主和表空间sql