LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-07-2014, 05:37 PM   #1
postcd
Member
 
Registered: Oct 2013
Posts: 400

Rep: Reputation: Disabled
Run script from within a script and then continue?


Code:
echo "Run vzmigrate (m) or run vzdump (d) now? or any other key to continue."
read vmsbckp
if [ "$vmsbckp" == "m" ];then
./root/vzmigrate
fi
if [ "$bmsbackup" == "d" ];then
./root/vmsbackup
ls -l /home/vmsbackup
fi
echo "That is all, nothing more to be done in backup process."
when i selected "d"

it just skipped and exitted the script. Can i modiffy anyhow script so it start another script and then when this finish it automatically continue my firs initial script?
 
Old 03-07-2014, 05:40 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Are you sure it skipped it? Chances are the script you were calling just didn't do anything (errored out, etc). Try running with "set -x".
 
Old 03-07-2014, 06:16 PM   #3
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,471

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444
try either of these forms

Code:
if [ <condition> ]; then
    # note space between ; and then
    <code>
fi

Code:
if [ <condition> ]
then
    <code>
fi

Edit, you might want to consider case

Code:
read vmsbckp
case $vmsbckp in
    M|m) <code>
      ;;
    D|d) <code>
      ;;
      *) echo "wrong answer!"
      ;;
esac

Last edited by Firerat; 03-07-2014 at 06:22 PM.
 
  


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
[SOLVED] net snmp pass persist script, can not run a bash script!! Linux Chips Linux - General 4 12-23-2012 02:50 PM
MySQL Updates With Null When Perl Script Run From Shell Script ThisGuyIKnow Programming 6 08-12-2008 10:56 AM
Will script continue to run even after closing putty for remote access anjanesh Linux - Newbie 11 08-07-2006 04:05 AM
on Network Up Script run? On Battery power run script? v2-ncl Linux - General 0 12-08-2003 10:34 AM
Continue running a script after logging out? AlvinK Linux - Newbie 0 08-28-2003 07:32 AM


All times are GMT -5. The time now is 11:00 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration