我的问题是我不明白为什么当我运行脚本时,如果我写“是”或“否”,它总是说我正在退出脚本。我知道它不承认$reply
和“是”是平等的,但为什么呢?(我是 bash 编程的新手)。谢谢!
#!/bin/bash
clear
echo 'This script will install: Firefox 17.0.1 (language: enGB or itIT or enUS) and flash 11 in Firefox17.0.1, continue?'
read reply
if (( "$reply" = "yes" )); then
pkill firefox
rm -rf /tmp/fox
mkdir /tmp/fox
cd /tmp/fox
rm -rf /opt/firefox/*
rm -rf /usr/lib/mozilla/plugins/*
rm -f /usr/share/icons/mozicon128.png
mkdir /usr/lib/mozilla/plugins
mkdir /opt/firefox
echo "Enter your language (exmp: it en us)"
read reply1
if (( "$reply1" = "it" )); then
wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-x86_64/it-IT/firefox-17.0.1.tar.bz2
elif (( "$reply1" = "en" )); then
wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-GB/firefox-17.0.1.tar.bz2
else
wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/firefox-17.0.1.tar.bz2
fi
wget http://fpdownload.macromedia.com/get/flashplayer/pdc/11.2.202.258/install_flash_player_11_linux.x86_64.tar.gz
wget http://upload.wikimedia.org/wikipedia/commons/7/76/Mozilla_Nightly_icon_2011.png
tar -xvf firefox-17.0.1.tar.bz2
tar -xvf install_flash_player_11_linux.x86_64.tar.gz
cp -R firefox/* /opt/firefox
cp libflashplayer.so /usr/lib/mozilla/plugins/
rm -f /opt/firefox/icons/mozicon128.png
cp -f Mozilla_Nightly_icon_2011.png /opt/firefox/icons/mozicon128.png
echo "Reboot the system to show the new icon?"
read response
if (( "$response" = "yes" )); then
reboot
else
echo 'Installation Complete'
fi
else
echo "I'm quitting the script..."
exit
fi