shell腳本

1、寫命令到test.sh中

simon@ubuntu:~/Desktop/Link to rpcproto/merchantpay$ echo echo "hello" > test.sh
simon@ubuntu:~/Desktop/Link to rpcproto/merchantpay$ cat test.sh 
echo hello
simon@ubuntu:~/Desktop/Link to rpcproto/merchantpay$ /bin/sh test.sh hello
simon@ubuntu:~/Desktop/Link to rpcproto/merchantpay$ 

2、在文件中寫上

!/bin/bash
echo "Hello World !"

或者

!/bin/sh
echo "Hello World !"

需保存爲XX.sh
需要添加執行權限,否則無法運行

chmod +x ./test.sh  #使腳本具有執行權限
./test.sh  #執行腳本
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章