Roger Penuela

IT Engineer

Ubuntu, centOS and oracle linux

the following is a simple shell script to install multiple programs

Part1 is more simple to understand by a person just starting to program

part2 is more complex uses if statement and for loop

Part1
#!/bin/bash
#this is an introduction to bash shell to install multiple programs faster
#!/bin/bash
#this programs will ask the user if they agree to update
"
 
 np="install"
 nt="y" 
 echo "the following programs will be install after update"
 echo "krita, blender, docker, ansible, virtualbox, darktable "
 read nb
 echo"please enter the command to install be ether (apt or dnf)
 read nr
 if [ $nb = $nt ];
 then
         $nr update
         $nr upgrade -y
         $nr dist-upgrade -y
         $nr $np blender -y
         $nr $np docker -y
         $nr $np docker.io -y
         $nr $np ansible -y
         $nr $np virtualbox -y
         $nr $np darktable -y
         $nr autoremove -y
fi

if you want to use a more complex and code saving  use part two and just add 
the programs you want on the array

Part2
!/bin/bash
 #the scrip will ask the person what command to install and if you want to continue or not
 #then  run the installation by looping on the array
 ne=( krita blender htop virtualbox ansible leafpad zenmap brackets macchanger darktable )
 np="install"
 nt="y"
 echo "the following programs will be install"
 echo "krita, blender, htop, virtualbox , ansibel y/n"
 read nb
 echo "please enter the installation command (apt or dnf )"
 read nh
 if [ $nb = $nt ];
 then
         $nh update
         $nh dist-upgrade -y
         $nh upgrade -y
         for i in ${ne[@]}
         do
                 $nh $np $i -y
         done
 else
         echo "may be next time "
 fi

those are two different script one more complex than the other but both do the same process install programs

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact

For further details about my services, availability and inquiry, please feel free to contact me with the information below