Ok, i need some help with this bash script. Everything runs great until i hit the if else statement then i get this,
Do they want adminmod?
yes
./install_cs: [: yes: integer expression expected
./install_cs: line 29: syntax error near unexpected token `fi'
./install_cs: line 29: ` fi'
root@ds6 [~]#
This is the script, any help would be greatly appreciated.
#!/bin/bash
echo "Welcome to the install script"
sleep 2
echo "What username to add?"
read usern
echo "If your not ROOT this will not work"
adduser $usern
echo "Now you need to type the password for this account"
passwd $usern
sleep 2
echo "How many players?"
read players
cd /home/$usern
sudo -u $usern cp /usr/local/files/hlds_l_3111_full.tar.gz /home/$usern
sudo -u $usern cp /usr/local/files/cs_15_full.tar.gz /home/$usern
sudo -u $usern tar zxvf /home/$usern/hlds_l_3111_full.tar.gz
sudo -u $usern tar zxvf /home/$usern/cs_15_full.tar.gz
echo "Do they want adminmod?"
read adminmod
if [ $adminmod -ne yes ]
then
sudo -u $usern cp /usr/local/files/halflife-admin 2.50.52.tgz /home/$usern
sudo -u $usern tar zxvf /home/$usern/halflife-admin-2.50.52.tgz
cd /home/$usern/Adminmod
sudo -u $usern /home/$usern/Adminmod/install_admin
fi
if [ $adminmod -ne no ]
then
fi
Do they want adminmod?
yes
./install_cs: [: yes: integer expression expected
./install_cs: line 29: syntax error near unexpected token `fi'
./install_cs: line 29: ` fi'
root@ds6 [~]#
This is the script, any help would be greatly appreciated.
#!/bin/bash
echo "Welcome to the install script"
sleep 2
echo "What username to add?"
read usern
echo "If your not ROOT this will not work"
adduser $usern
echo "Now you need to type the password for this account"
passwd $usern
sleep 2
echo "How many players?"
read players
cd /home/$usern
sudo -u $usern cp /usr/local/files/hlds_l_3111_full.tar.gz /home/$usern
sudo -u $usern cp /usr/local/files/cs_15_full.tar.gz /home/$usern
sudo -u $usern tar zxvf /home/$usern/hlds_l_3111_full.tar.gz
sudo -u $usern tar zxvf /home/$usern/cs_15_full.tar.gz
echo "Do they want adminmod?"
read adminmod
if [ $adminmod -ne yes ]
then
sudo -u $usern cp /usr/local/files/halflife-admin 2.50.52.tgz /home/$usern
sudo -u $usern tar zxvf /home/$usern/halflife-admin-2.50.52.tgz
cd /home/$usern/Adminmod
sudo -u $usern /home/$usern/Adminmod/install_admin
fi
if [ $adminmod -ne no ]
then
fi