Welcome to the Linux Foundation Forum!

Working on a Bash Script

bfpa40 Posts: 2
edited October 3 in Command Line/Scripting

I have the following bash script that is working. However I want to enter an argument as i execute the script like so: ./test.sh pdj1compC So it will use that argument and NOT print out the echo statement when it gets down to that line of the script for just that one item all the others will print out. This is a test script ill build off to conduct a certain job so as it is its goofy I know. I just need assistance to get me over this mental block im having. Thank You

Here is the script:


n="1 2 3 4 5 6"

m="compA compB compC compD"

echo " Do you wish to logoff all the computers is so enter y otherwise just press Enter"

read logoff

if [ $logoff == y ]


for j in $n


for k in $m

do echo "Hello there this is Comjputer pdj$j$k ; whoami "




echo "Returning to prompt"


echo "This script is complete"


Upcoming Training