0% found this document useful (0 votes)
12 views3 pages

Bash Shell Script

The document provides instructions for creating and executing a shell script named 'build.sh' using various commands, including setting permissions and updating timestamps. It covers shell script variables, comparison operators, conditional statements (if, if-else, if-elif-else), switch-case structures, and loop constructs (while and for). Additionally, it briefly mentions troubleshooting issues related to screen refresh and updating processes.

Uploaded by

Sharu 06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Bash Shell Script

The document provides instructions for creating and executing a shell script named 'build.sh' using various commands, including setting permissions and updating timestamps. It covers shell script variables, comparison operators, conditional statements (if, if-else, if-elif-else), switch-case structures, and loop constructs (while and for). Additionally, it briefly mentions troubleshooting issues related to screen refresh and updating processes.

Uploaded by

Sharu 06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

!

bin/#bash

chmod u+x build.sh

creation of shell script file using commands.

build.sh -> example file name

>touch build.sh

>touch -a build.sh -> update the read time

>touch - m build.sh -> update the write time

>touch - t 202503120530.00 build.sh

>touch - d "2025-03-12 05:30:00" build.sh

this script is not executable by default we have to permission for execution

chmod +x build.sh -> access to all user,group,other.


chmod u+x build.sh -> access to owner of the file.

shell script variables:

system defined variables or env


user defined variables.

echo $USER -> env


user_variable = "hii"
echo $user_variable

specify the shell script


#!bin/bash -> this line is called as shebang line.

comparsion operator .

-eq -> equal to


-lt -> less than
-le -> less or equal to
-gt -> greater equal to
-ne -> not equal

string comparison

== equal to
!= not equal
\< less than
\> greater than

condition operator :

*****if statemet

#!bin/bash
x= 10
y=11

if[$x -ne $y]


then
echo " not equal"
fi

*****if else statemet

#!bin/bash

x=10
y=10

if [$x -eq $y]


then
echo "equal"
else
echo "not equal"
fi

******if elif else fi

#!bin/bash

x=10
y=11

if [$x -lt $y]


then
echo "equal"
elif [$x -gt $y]
echo " not equal"
else
echo "may be equal"
echo $x $y
fi

******swicth case :

FRUIT ="apple"

case "$FRUIT" in

#case 1
"orange") echo " matched with orange";;
#case 2
"mango") echo " matched with mango";;
#case3
"apple") echo "matched with apple";;
esac

loops

******while loops
#!bin/bash

x=2

while[$x -lt 6]
do
echo $x
x= 'expr $x+1'
done

*******for loop
for var in 2 4 5 6
do
#statment
done

not going into cluster fw

check screen refresh issue (removing the sd card, wrong file name,)
while updating turned off key
removed can high/low wire while updating...

You might also like