restart or invoke a shell script from inside in linux

As an Unix or Database Administrator, we often write a shell script to perform maintenance task which can be called manually , in crontab or scheduled in deployment pipeline.

Requirement to invoke a shell script within a single call helps to reuse the input's passed such as  password , file name or any other input variable.

The EASY method to do the same is by recalling shell script within a shell script again ...


sh $0 $1

The SMART way to do the same is by using the goto method to call a block for re-invoking a part of the code ...


echo "Part of Code to be invoke repeatedly.." 

while true; do

 echo -n "Proceed Y/N:"
read INPUT

 if [ $INPUT == "Y" ] ; then


No comments:

Post a Comment