cancel
Showing results for 
Search instead for 
Did you mean: 
jeesshnasree
Starfighter Starfighter
Starfighter
  • 1,246 Views

How to use multiple scripts call from bash script in linux

Hi All,

 

I have 3 prepared 3  bash scripts as per requirement , please suggest 3 or many scripts call from one main script . 

 

Example:

As per criteria script build for various purpose .

1.   Application backup script 

2 .  Application deploy script 

3 .  Application roll back script 

 

As per above criteria i have prepared 3 or N (here N is number from 2 to many) scripts but need combine in one script for layman's understand purpose .

Please guide me for combine scipts in one single script as per require option that script should run .

if possible as mentioned above criteria then please guide me .

 

I hope explained my problem clearly . 

I am waiting for your valuable information .

 

Regards,

Jeesshnasree

Labels (1)
9 Replies
Trevor
Starfighter Starfighter
Starfighter
  • 1,199 Views

I'm going to have to ask that you restate your query.  I've read it a couple of times, but I'm not able to decipher exactly what you're asking.

Trevor "Red Hat Evangelist" Chandler
dkcbk
Flight Engineer
Flight Engineer
  • 1,159 Views

If you need to execute 3 scripts from one main script, you should create main.sh script which contains:
./script1.sh
./script2.sh
./script3.sh

Then execute it: ./main.sh
Make sure all your scripts have execute permission.
I dont know if this is the correct answer to your question, because your instructions are very confusing  .

jeesshnasree
Starfighter Starfighter
Starfighter
  • 1,151 Views

Hi ,

 

that script means 1 after one execution but my requirement is like menu .

if select option then execute accordingly as per scripts. 
please provide if not possible merge then how to execute required options in one program. Please guide me..

jeesshnasree
Starfighter Starfighter
Starfighter
  • 1,147 Views

Please cancel Accepted  solution it's wrongly selected due to stuck system.

Chetan_Tiwary_
Community Manager
Community Manager
  • 1,113 Views

@jeesshnasree I have removed the wrongly marked solution.

0 Kudos
jeesshnasree
Starfighter Starfighter
Starfighter
  • 1,145 Views

Please provide me revoke option for Accepted as Solution option.

Chetan_Tiwary_
Community Manager
Community Manager
  • 1,114 Views

@jeesshnasree if you know the concept of function, while loop and case statements in bash scripting, you can easily write a main script which can display menu options to user and based on user selection execute the corresponding scripts. 

eg. use a function to display the menu to a user in number of options with a title of the options using "echo" :

function script_menu {

    echo "1) App Backup (./backup.sh)"
    echo "2) App Deploy (./deploy.sh)"
    echo "3) App Rollback (./rollback.sh)"

    echo "4) Exit"

    echo -n "Enter your choice (1-3): "

}

Then use while loop to read the user choice and evaluate the options and run the fucntion. use case statement to run the corresponding script for appropriate user choice. 

Chetan_Tiwary__1-1722197184328.png

 

 

jeesshnasree
Starfighter Starfighter
Starfighter
  • 1,094 Views

Hi @Chetan_Tiwary_ ,

 

Please provide sample of the script above execution , if possible please share .

jeesshnasree
Starfighter Starfighter
Starfighter
  • 1,086 Views

Hi @Chetan_Tiwary_ ,

 

please ingore avove message & now  i got it .  Thank you 

Join the discussion
You must log in to join this conversation.