How to run .sh file in other script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to run .sh file in other script?
# 1  
Old 07-28-2013
How to run .sh file in other script?

Hii friends,
Actually, I am a beginner in shell scripting. I am trying to run a master .sh file. The master .sh file will open 2 different terminals and then run .sh file on first terminal, an executable file in second terminal.
We, the beginners, can learn a lot if the "gurus" like you will help us.

Thanks in advance

---------- Post updated at 04:41 AM ---------- Previous update was at 04:24 AM ----------

Someone please help me..... I am not getting any solution for this problem.
Please help me

Last edited by sachinteotia; 07-28-2013 at 08:05 PM..
# 2  
Old 07-28-2013
Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

Be patient, somebody will probably answer your question.

Thank You.

The UNIX and Linux Forums.
# 3  
Old 07-28-2013
Quote:
Originally Posted by sachinteotia
Hii friends,
Actually, I am a beginner in shell scripting. I am trying to run a master .sh file. The master .sh file will open 2 different terminals and then run .sh file on first terminal, an executable file in second terminal.
We, the beginners, can learn a lot if the "gurus" like you will help us.

Thanks in advance
If you would show us what you've tried, explain in detail what you want the two "terminals" to do, and explain what is happening with your current script; we would have a much better chance of helping you. The statement you have made so far is so vague that we don't really have any idea how to help you.
# 4  
Old 07-29-2013
Computer

Hi all,
Actually, I am working on netFPGA platform. In that, I want to run a script file which will first perform some commands and then open two separate terminals. In the first terminal, I want to run another script and in the second terminal, I want to run an executable file ./scone.
Code:
#!bin /bash
/usr/local/sbin/cpci_reprogram.pl --all

/* open a new terminal. In that terminal, change directory and then run ./scone */
gnome-terminal --tab -e cd /usr/local/netfpga/projects/scone/sw
./scone

/* open another terminal. In that terminal, change directory and then run router.sh */
gnome-terminal --tab -e cd /usr/local/netfpga/lib/java/gui/
./router.sh

# 5  
Old 07-29-2013
You can use nohup command to put one of your script to background while other will continue to run in the foreground.

Code:
 
nohup ./scone &

This User Gave Thanks to millan For This Post:
# 6  
Old 07-29-2013
Thanks milan for your valuable help. Still its not working

Error:
Code:
nohup: appending output to `nohup.out'
nohup: failed to run command `./scone': No such file or directory

.scone file has to be run from root with all permissions.
How can I do "su root" in script, so that my .scone file may run.
# 7  
Old 07-29-2013
I suspect it means what it says -- there is no file named 'scone' in the current folder.

Usually you would use sudo to run su automatically.
Code:
sudo /absolute/path/to/programname

You can configure sudo with visudo to permit yourself or permit very specific things to run passwordlessly.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

2. Shell Programming and Scripting

Script to read a log file and run 2nd script if the dates match

# cat /tmp/checkdate.log SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 17 22:49:00 2012 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production FIRST_TIME NEXT_TIME... (1 Reply)
Discussion started by: SarwalR
1 Replies

3. Shell Programming and Scripting

How to run a file in a csh script?

Hi, I have a csh script. I want to set some variables and execute some command from a file in that script. abc.csh echo "primary script" b setenv XXX ddd set XX make abc I want to execute the commands of "b" file from abc.csh. How can i do that. Please view this link: How to use... (3 Replies)
Discussion started by: vdhingra123
3 Replies

4. Shell Programming and Scripting

How to run a script using batch file?

the manual process which we follow is login to remote unix box thro putty using the unix account and password and then sudo to root user. server name:abc@server.com login as:pqrst password:****** $ sudo su - root then run the script stored on remote server under root account. ... (9 Replies)
Discussion started by: gpk_newbie
9 Replies

5. Shell Programming and Scripting

Make script that run with argument if not run from configuration file argument

Hello, Is there any method thorugh which script can take argument if pass otherwise if argument doesn't pass then it takes the argument from the configuration file i.e I am workiing on a script which will run through crontab and the script will chekout the code ,zip and copy to the... (3 Replies)
Discussion started by: rohit22hamirpur
3 Replies

6. Shell Programming and Scripting

Run script if new file exists.

Is there any way to have a script run (either on a web page or a shell script) when new files are put in a folder. E.g we have order response notification XML files uploaded to our server. They are uploaded via sftp. What i wondered if there was some way to monitor the contents and if new files... (4 Replies)
Discussion started by: timgolding
4 Replies

7. Shell Programming and Scripting

File detection then run script

I am currently running 4 scripts to complete a job for me. Each script requires the finished file of the one before it. For example the first script gets the finished file called model.x, then i would like script2 to start in and use model.x as the input and get model_min.x as the finished... (5 Replies)
Discussion started by: olifu02
5 Replies

8. Shell Programming and Scripting

how to let the perl script to run for each file

Hi, I have more than 1 files in the directory. In bash, I can use cd /work for x in `ls` do : : done to run for each file in the directory. How about in perl script? filepath="ABC1" open(FILE, $filepath) or die "$filepath cannot be opened."; while(<FILE>) { : (1 Reply)
Discussion started by: natalie23
1 Replies

9. Shell Programming and Scripting

script run from other file

Hi I have script which has following command mysql -u $DATABASE_USER -p$DATABASE_PASSWORD $DATABASE_NAME -e "show tables" >$TABLELIST where TABLELIST="/tmp/tablelist" all tables of database will be save in /tmp/tablelist now i want to optimize these table listed in /tmp/tablelist... (1 Reply)
Discussion started by: kaushik02018
1 Replies
Login or Register to Ask a Question