LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-12-2011, 01:01 AM   #1
BigBoots623
LQ Newbie
 
Registered: Apr 2011
Posts: 5

Rep: Reputation: 0
Executing a script from within a script


How would I execute a shell script from within another. For instance I have one script that acts as a main menu, the user picks a choice from menu and if 'x' is picked then current menu is exited and 'x' script is run. THX
 
Old 04-12-2011, 01:13 AM   #2
Walter.Stroebel
LQ Newbie
 
Registered: Apr 2011
Location: Arnhem, The Netherlands
Distribution: CentOS
Posts: 19

Rep: Reputation: 6
I suppose you mean something like this:
-------------------
#!/bin/bash
echo 1. hello
echo 2. bye
read a
if [ $a == "1" ] ; then hello.sh ; fi
if [ $a == "2" ] ; then bye.sh ; fi
 
Old 04-12-2011, 01:39 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,243

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
Unless the scripts are in your PATH, the above will not work and you will need to provide the path to the script.
You may also wish to have a look at the 'select' command.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing a Shell script with 654 permissions inside another shell script. changusee2k Linux - Newbie 2 06-07-2011 08:58 PM
Bash Script - executing answer to another script domz Programming 4 11-07-2010 05:19 PM
Run an external script, without holding up the currently executing script onesikgypo Programming 2 03-07-2009 10:26 PM
need help executing a script that someone sent me giantjoebot Linux - Newbie 16 08-13-2008 01:35 AM
Bash script - executing a script through subdirectories bubkus_jones Programming 5 04-24-2006 06:05 PM


All times are GMT -5. The time now is 11:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration