We can modularize the code in Shell Script as well as with the other languages. Separate the common functionality into separate functions so that they can be used anywhere in the script. Also this makes the big programs to easily understand.

e.g.
# Shell script to demonstrate functions.
function1(){
echo "this is the first function"
}

function2(){
echo "this is function 2"
echo "this function has the argument 1 with value $1"
}

# Calling the functions in the script
function1
function2(54)

Like it on Facebook, +1 on Google, Tweet it or share this article on other bookmarking websites.

Comments (0)

There are no comments posted here yet