Shell Script Basics

Shell scripting is an important part of process automation in Linux. Scripting helps you write a sequence of commands in a file and then execute them.

Type of Shell:

  • Bourne Shell
  • C Shell
  • Korn Shell
  • Bourne-Again Shell (BASH)

How to create shall script file?

Your script file name is File_name.sh

How to execute a shell script file?

  • sh filename.sh
  • ./filename.sh
  • . filename.sh

Shell Script Methods:

Dynamic:

Example:

echo "enter two values:"
read a
read b
c=expr $a + $b
echo "Result is: $c"

Static:

Example:

a=360
b=420
c=expr $a + $b
echo "Result is: $c"

Argument Parsing:

Example:

c=expr $1 + $2
echo "Result is: $c"
echo "Total number of values: $#"
echo "Show values: $*"
echo "show file Name: $0"

Popular posts from this blog

Oracle Database 19C Performance Tunning - PART 1

Oracle RMAN Backup And Restore

Oracle Patching Using Opatch Utility

Welcome to DBA Master – Database Tips, Tricks, and Tutorials

Oracle 19c Database Software Installation in OEL8

PostgreSQL Triggers

PostgreSQL Opensource Installation in RHEL or Oracle Linux(OEL) 8 and above

PostgreSQL Cursor

PostgreSQL Procedures

PostgreSQL User & Role Management