Help with shell script

Hey guys n gals,

I have a shell script which I use everytime there’s a nagios update. I want to however allow a manual input for the file version instead of editing the file the whole time. I’m not sure how to go about it. (windows no problem :stuck_out_tongue: )

Anyhow here’s the script (I want variables input on the version numbers, eg now it’s 4.3.1 then next week it’s say 4.3.2)
So it should prompt me which version number, then replace the version numbers in the script.

#!/bin/bash cd ~/temp sudo wget sudo tar xzf nagios-4.3.1.tar.gz cd ~/temp/nagios-4.3.1 sudo ./configure --with-command-group=nagcmd sudo make all sudo make install

Something like:

read -p "Enter Version number: " ver nagios-$ver.tar.gz ?

cd ~/temp
echo -n "Enter Version Number: "
read vers
sudo wget${vers}.tar.gz
sudo tar xzf nagios-${vers}.tar.gz
cd ~/temp/nagios-${vers}
sudo ./configure --with-command-group=nagcmd
sudo make all
sudo make install
1 Like