- 變數要用
$表示 $0、$1表示command line傳入的參數
- {1..10}表示從1~10
- do ... done 的裡面會執行程式
for i in {1..10}
do
echo $i
done
// 1,2,3,4,5,6,7,8,9,19迴圈如果會用到「變數」要改用seq
for i in $(seq 1 $1)
do
touch $i.js;
echo $i
done
// 輸入3,可以產生1.js,2.js,3.js檔案curl:可以用來獲取網站- pup: pup is a command line tool for processing HTML
curl https://github.com/$1 | \
pup 'span.vcard-fullname,'\
'div.js-user-profile-bio,'\
'span.p-label,'\
'a[rel="nofollow me"] text{}'- $ ./test.sh 或是 sh test.sh
- 第一種方法要用
chmod+x test.sh更改權限(ll可以看到權限)