Home
Categories
WIKI
Topic
User
LANGUAGE:
中文
English
请教:如何在每次暂停时增加“Y” “N”选择是否执行本段命令?“y"执行本段,”n"跳到下一段?
社区开发
2338
views ·
2
replies ·
To
floor
Go
Coollove
deepin
2012-04-21 18:31
Author
代碼:
#! /bin/bash
function pause(){
read -n 1 -p "$*" INP
if [[ $INP != '' ]] ; then
echo -ne '\b \n'
fi
}
echo “请设置root密码”
pause 'Press [Enter] key to continue...'
sudo passwd root
echo “同步Reaver设置”
pause 'Press [Enter] key to continue...'
Folder=~/.config/reaver
if [ -d "$Folder" ]; then
sudo rm -fr /usr/local/etc/reaver
sudo ln -fsT ~/.config/reaver /usr/local/etc/reaver
else
mkdir -p "$Folder"
cp -at /usr/local/etc/reaver ~/.config/reaver
fi
echo “设置本地源”
pause 'Press [Enter] key to continue...'
Folder="/media/iData/Backup/Ubuntu/Packages"
if [ -d "$Folder" ]; then
sudo rm -fr /var/cache/apt/archives
sudo ln -fsT "/media/iData/Backup/Ubuntu/Packages" "/var/cache/apt/archives"
else
mkdir -p "$Folder"
fi
#sources.list
sudo add-apt-repository ppa:kernel-ppa/pre-proposed
sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo add-apt-repository ppa:tualatrix/ppa
sudo add-apt-repository ppa:ubun-tor/ppa
sudo add-apt-repository ppa:deluge-team/ppa
sudo add-apt-repository ppa:hydr0g3n/ppa
sudo add-apt-repository ppa:thopiekar/oneiric-dev
sudo add-apt-repository ppa:jason-scheunemann/ppa
sudo add-apt-repository ppa:team-xbmc/unstable
sudo add-apt-repository ppa:jonoomph/openshot-edge
echo “更新系统”
pause 'Press [Enter] key to continue...'
sudo apt-get update
sudo apt-get dist-upgrade
echo “任意键退出”
pause 'Press any key to continue...'
Copy the Code
请教:如何在每次暂停时增加“Y” “N”选择是否执行本段命令?“y"执行本段,”n"跳到下一段?
Reply
Like 0
Favorite
View the author
All Replies
tuhaihe
deepin
2012-04-26 18:09
#1
是不是来个条件判断?
Reply
Like 0
View the author
cnchanghai
deepin
2012-05-31 02:07
#2
我也不懂,但是我认为你可以做个输入
像这个
echo 请选择
a=get
if a==‘Y’
。。。
else
。。。
Reply
Like 0
View the author
Please
sign
in first
New Thread
Popular Ranking
Change
translation
deepin install 23
剪切板增加关键字过滤功能
configurar teclado macbook pro 2011
Muon app from app store
Install Deepin 23 (preview) for LOONGSON 3A6000 Machine.
Popular Events
More
请教:如何在每次暂停时增加“Y” “N”选择是否执行本段命令?“y"执行本段,”n"跳到下一段?