i've created bash program using whiptail
give graphical type interface user setup system. reason script isn't running of bash commands though, instead seems cycling through outputting log.txt
file, no packages being installed.
status=0 touch log.txt while [ $status -lt 100 ]; # update apt repos apt-get update wait echo "apt-get update" >> log.txt let status=status+15 echo $status # update apt package apt-get upgrade wait echo "apt-get upgrade" >> log.txt let status=status+15 echo $status # install required packages apt-get -y git-all nmap hydra wait echo "apt-get -y git-all nmap hydra" >> log.txt let status=status+10 echo $status # install rbenv git clone https://github.com/rbenv/rbenv.git ~/.rbenv wait echo "cloning rbenv" >> log.txt echo 'export path="$home/.rbenv/bin:$path"' >> ~/.bash_profile echo 'exporting path' >> log.txt ~/.rbenv/bin/rbenv init wait echo 'initializing rbenv' >> log.txt git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build wait echo "cloning ruby-build" >> log.txt rbenv install 2.1.4 wait echo "installing ruby 2.1.4" >> log.txt let status=status+25 echo $status done | whiptail --gauge "setting neo (this take time)..." 40 78 0
so, confirm while loop running, started echoing things log.txt
. here output:
apt-get update apt-get upgrade apt-get -y git-all nmap hydra cloning rbenv exporting path initializing rbenv cloning ruby-build installing ruby 2.1.4
what have done wrong?
first, since have no backgrounded processes, wait
not doing anything.
second, since whiptail
reading stdin, need ensure stdout apt-get, git, rbenv, etc commands redirected stderr, or better, log.
# update apt repos echo "apt-get update" >> log.txt apt-get update >>log.txt 2>&1 (( status += 15 )) echo $status # update apt package echo "apt-get upgrade" >> log.txt apt-get upgrade >> log.txt 2>&1 (( status += 15 )) echo $status
and on.
Comments
Post a Comment