LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-11-2005, 09:05 AM   #1
mjtice
LQ Newbie
 
Registered: Feb 2005
Posts: 12

Rep: Reputation: 0
call another script and have the inital script exit


Hello,
Sorry if this has been asked/answered before - I looked but couldn't find exactly what I'm looking for. What I want is this: I want to execute a script, and from within that echo some variables to a text file (I couldn't find another way to do it) - then call a second script from within that script and read those variables from the text file. Here's a cutout of the two scripts:

#!/bin/bash
UPLOAD_VUSER="cmc"
UPLOAD_SIZE="1223344"
echo ${UPLOAD_VUSER},${UPLOAD_SIZE} > /tmp/variables
source /tmp/exec2.sh
exit 0

#!/bin/bash
UPLOAD_VUSER=`cut -d"," -f1 ./variables`
UPLOAD_SIZE=`cut -d"," -f2 ./variables`
echo ${UPLOAD_VUSER}
echo ${UPLOAD_SIZE}
exit 0

All is fine, the second script 'exec2.sh' is called and run - but the first script still exists. Is there a way to call the second script and then immediately exit the first script? Any help would be appreciated.

Thanks,
mjtice
 
Old 09-11-2005, 11:54 AM   #2
addy86
Member
 
Registered: Nov 2004
Location: Germany
Distribution: Debian Testing
Posts: 332

Rep: Reputation: 31
Re: call another script and have the inital script exit

Try to change
source /tmp/exec2.sh
to
/tmp/exec2.sh&

exec2.sh needs execute permissions to do this.
 
  


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
How to call a script from a system startup script? jonatito Linux - Newbie 7 11-11-2005 09:40 PM
Do not stop or exit from a script in case of error. philipina Linux - General 4 07-02-2004 06:52 AM
Invoke script on xsession exit? comp12345 Linux - Software 1 06-27-2004 10:27 PM
My shell script can't seem to call another script kakho Programming 3 04-17-2004 09:21 AM
script 'exit' command kilobravo Linux - General 8 01-16-2003 03:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:30 PM.

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
Open Source Consulting | Domain Registration