shell 腳本初體驗

今天上機學了幾個小命令

  • read
  • echo
  • if
    然後自己寫了一個小腳本覺得還挺有趣的
#!/bin/bash
#liruihao
#menu.sh
#sudo apt curl install nyancat sl figlet toilet cowsay 
echo "-------------菜-單--------------"
echo "------------1-打印二維碼--------"
echo "------------2-彩虹貓------------"
echo "------------3-小火切------------"
echo "------------4-打字機------------"
echo "------------5-小許牛------------"
echo "----------Ctrl+c暫停程序--------"
echo ""
echo "請輸入序號!"
read i
if test $i -eq 1
then
	echo "請輸入網址!"
	read s1
       	echo $s1 |curl -F-=\<- qrenco.de
fi
if test $i -eq 2
then
	nyancat
fi
if test $i -eq 3
then
	sl
fi
if test $i -eq 4
then
	echo "請輸入字符串!"
	read s2
	echo "選擇樣式:"
	echo "------樣式1-----"
	echo "------樣式2-----"
	read j
	if test $j -eq 1
	then
		figlet $s2
	else
		toilet -f mono12 -F gay $s2
	fi
fi
if test $i -eq 5
then
	echo "請輸入字符串!"
	read s3
	cowsay $s3
fi
echo "任意建繼續!"
read x
clear
./menu.sh

本文作者: 李瑞豪
修改時間: 2019-02-18 11:27:09
本文鏈接: https://lruihao.cn/linux/shell.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章