cd
命令移動(dòng)至目標(biāo)目錄。touch
命令創(chuàng)建一個(gè)空文件命名為bash_script.sh
作為shell腳本的容器。bash_script.sh
文件的所有權(quán)限屬性,在下圖中可以看到該文件沒(méi)有運(yùn)行權(quán)限。
bash_script.sh
,此處以gedit
作為例子:
$ gedit bash_script.sh
Hello World!
。
#!/bin/bash
## This is the basic bash script
echo " Hello World!"
Ball Shell
的路徑echo
命令執(zhí)行打印輸出內(nèi)容
$ chmod +x bash_script.sh
./
執(zhí)行腳本,打印輸出。
$ ./bash_script.sh
Hello World!
更多建議: