文件包含 兩種方式
#語(yǔ)法一:
./filename.sh
#語(yǔ)法二:
shource filename.sh
fileA.sh 內(nèi)容:
#!/bin/bash
echo "me is fileA.sh"
fileB.sh 內(nèi)容:
#!/bin/bash
./fileA.sh
source fileA.sh
source /Users/root/Desktop/fileC.sh
echo "me is fileB.sh"
url:
屏幕快照 2017-11-02 下午11.21.45.png
cat
作用
- 查看文件內(nèi)容
#語(yǔ)法 cat [選項(xiàng)] [文件]
cat fileA.sh
#-n 顯示內(nèi)容和行號(hào)
#-b 和-n類(lèi)似功能,只標(biāo)記非空白行
#-e 在每一行后面加入 ‘$’ 符號(hào),在多行轉(zhuǎn)換為一行內(nèi)容的時(shí)候有用
cat -n fileA.sh
- 鏈接文件
- 創(chuàng)建一個(gè)多個(gè)文件
- 重定向輸出到終端
- 重定向到文件

屏幕快照 2017-11-02 下午11.31.26.png
read
文件內(nèi)容:
#!/bin/bash
echo "me is fileA.sh"
read name
echo "名字為:${name}"

屏幕快照 2017-11-02 下午11.39.17.png