LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Calling a bash shell script from within another script (http://www.linuxquestions.org/questions/linux-software-2/calling-a-bash-shell-script-from-within-another-script-801146/)

dedman 04-09-2010 07:42 PM

Calling a bash shell script from within another script
 
I am trying to call a script say mkdir.sh into another script that will make use of the dir's which are created in the first script. I know that I could code it all together, but I am trying to avoid rewriting the mkdir script as it is long. any help would be great.

smoker 04-09-2010 07:54 PM

Is google broken tonight ?
http://www.google.co.uk/search?num=2...=&oq=&gs_rfai=

dedman 04-09-2010 07:57 PM

Tried Google
 
Didn't type it the way you did though, thanks.
Didn't help much I'll keep trying

pixellany 04-09-2010 08:44 PM

A shell script can call any legal command, even if it is another script. Just be sure all the required permissions are set and that the called items are in $PATH, or are called with full pathnames.

catkin 04-10-2010 06:25 AM

Quote:

Originally Posted by dedman (Post 3930483)
I am trying to call a script say mkdir.sh into another script that will make use of the dir's which are created in the first script. I know that I could code it all together, but I am trying to avoid rewriting the mkdir script as it is long. any help would be great.

I don't understand what you want to do. Do you want to call mkdir.sh from a script (let's call it a.sh) and have mkdir.sh make some directories and then have a.sh somehow get the names of the new directories? Will a.sh tell mkdir.sh which directories to make? How could anybody find out which directories mkdir.sh makes? Does it report what it is doing on stdout?

dedman 04-12-2010 06:11 PM

Quote:

Originally Posted by catkin (Post 3930826)
I don't understand what you want to do. Do you want to call mkdir.sh from a script (let's call it a.sh) and have mkdir.sh make some directories and then have a.sh somehow get the names of the new directories? Will a.sh tell mkdir.sh which directories to make? How could anybody find out which directories mkdir.sh makes? Does it report what it is doing on stdout?

Basically the mkdir.sh will make dir's which have been predetermined in the script. Then a.sh would call mkdir to run, and then sort through files in yet another dir and place them into the newly created dir's according to guidelines setforth by a.sh

catkin 04-13-2010 05:22 AM

Quote:

Originally Posted by dedman (Post 3933424)
Basically the mkdir.sh will make dir's which have been predetermined in the script. Then a.sh would call mkdir to run, and then sort through files in yet another dir and place them into the newly created dir's according to guidelines setforth by a.sh

That's good information. You can put a command in a.sh to call mkdir.sh, exactly as you would call mkdir.sh from the command line ... OK?

cola 04-24-2010 08:53 PM

Quote:

Originally Posted by dedman (Post 3933424)
Basically the mkdir.sh will make dir's which have been predetermined in the script. Then a.sh would call mkdir to run, and then sort through files in yet another dir and place them into the newly created dir's according to guidelines setforth by a.sh

You can call any script as you call it in terminal.
Make sure the script is executable.


All times are GMT -5. The time now is 06:48 PM.