LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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-16-2014, 12:55 AM   #1
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Rep: Reputation: Disabled
Creating a simple script that executes other scripts


Hello,

I'd like to create a simple script that would run the following commands:

Code:
$ cd /home/junior/Documents/Jogos/FlightGear/Jogo/simgear/simgear
$ git pull
$ cd
$ cd /home/junior/Documents/Jogos/FlightGear/Jogo/fgrun
$ git pull
$ cd
$ cd /home/junior/Documents/Jogos/FlightGear/Jogo/fgfs/flightgear
$ git pull
$ cd
$ cd Documents/Jogos/FlightGear/Jogo/install/fgfs/fgdata
$ git pull
EDIT: Didn't think it was going to work, but it did. The script:

Code:
cd /home/junior/Documents/Jogos/FlightGear/Jogo/simgear/simgear
git pull
cd
cd /home/junior/Documents/Jogos/FlightGear/Jogo/fgrun
git pull
cd
cd /home/junior/Documents/Jogos/FlightGear/Jogo/fgfs/flightgear
git pull
cd
cd Documents/Jogos/FlightGear/Jogo/install/fgfs/fgdata
git pull
Code:
[junior@junior Others]$ ./FG.sh
Already up-to-date.
Already up-to-date.
Already up-to-date.
Already up-to-date.
[junior@junior Others]$

Last edited by junior-s; 04-16-2014 at 01:12 AM.
 
Old 04-16-2014, 01:10 AM   #2
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Original Poster
Rep: Reputation: Disabled
Now I'm looking forward to execute other scripts inside this one. How can I? I'm trying this:

Code:
cd Documents/Jogos/FlightGear/Jogo/
./download_and_compile.sh -a n -p n SIMGEAR UPDATE
./download_and_compile.sh -a n -p n FGFS UPDATE
./download_and_compile.sh -a n -p n FGRUN UPDATE
But it gives me this:

Code:
[junior@junior Others]$ ./FG.sh
./FG.sh: line 1: cd: Documents/Jogos/FlightGear/Jogo/: No such file or directory
./FG.sh: line 2: ./download_and_compile.sh: No such file or directory
./FG.sh: line 3: ./download_and_compile.sh: No such file or directory
./FG.sh: line 4: ./download_and_compile.sh: No such file or directory
Yes, that file exists.

EDIT: Just needed a "cd" in the beginning.
Code:
cd
cd Documents/Jogos/FlightGear/Jogo/
./download_and_compile.sh -a n -p n SIMGEAR UPDATE
./download_and_compile.sh -a n -p n FGFS UPDATE
./download_and_compile.sh -a n -p n FGRUN UPDATE

Last edited by junior-s; 04-16-2014 at 01:12 AM.
 
Old 04-16-2014, 07:50 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
No need for 'cd' without any arguments; just use absolute paths as per the 1st 3 examples in your first post ie starting with 'cd /....'.
 
Old 04-16-2014, 04:27 PM   #4
junior-s
Member
 
Registered: Apr 2013
Location: Brazil
Distribution: Arch Linux
Posts: 137

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01 View Post
No need for 'cd' without any arguments; just use absolute paths as per the 1st 3 examples in your first post ie starting with 'cd /....'.
It didn't work because the initial script is not in my /home folder. Thus, the first "cd" is required.
 
  


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
Creating a simple Interpreter in C A.Thyssen Programming 5 09-29-2011 03:41 AM
Doc for creating a simple webpage satimis Linux - General 14 04-12-2011 06:32 AM
Need help getting started simple simple shell script dhonnoll78 Programming 6 12-17-2007 06:34 PM
creating simple sh daemon bobbens Programming 6 06-01-2005 12:10 PM
problems creating a simple bootable cd to perform a simple task czarherr Linux - Software 1 11-11-2004 06:22 AM


All times are GMT -5. The time now is 03:01 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