Results 1 to 6 of 6
Hi,
Im a total novice with Linux and am trying to alter a script on an embbed linux board.
Basically the script at the moment is..
cd /usr/bin
arm-app
So ...
- 03-02-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 2
Simple Linux script.
Hi,
Im a total novice with Linux and am trying to alter a script on an embbed linux board.
Basically the script at the moment is..
cd /usr/bin
arm-app
So it changes directory and then runs our arm application.
What I would like it to do is this.
cd /usr/bin
if FileExists ( Upgrade.tar) then
uncompress to local directory ( overwrite )
delete upgrade.tar
end
arm-app
Im sure this is "bread and butter" to you wizards, but I really am struggling being a poor windows user.
Appreciate any help you can give.
Regards
Ashley.
- 03-02-2009 #2
- 03-02-2009 #3Just Joined!
- Join Date
- Mar 2009
- Posts
- 2
Scripting
Hi,
Thanks for the help.
I copied that into the file and get an error.
./test.sh: line 4: syntax error near unexpected token `fi'
./test.sh: line 4: `fi'
Not to worry, I have had a look around the forum now and I see some other helpful chaps have linked to some handy scripting sites.
Thanks.
/Ash
- 03-02-2009 #4Just Joined!
- Join Date
- Feb 2009
- Posts
- 45
Originally Posted by RobinVossen The correct syntax is:
Originally Posted by tblue
Note: this code removes Upgrade.tar only if unpacking the file was successful. Furthermore it swallows any messages from both commands that are not delivered through the standard error output.Code:#! /bin/sh cd /usr/bin; if [ -e Upgrade.tar ]; then (tar -xf Upgrade.tar && rm Upgrade.tar) > /dev/null; fi
- 03-03-2009 #5
- 03-03-2009 #6Just Joined!
- Join Date
- Feb 2009
- Posts
- 45
Iʼm sorry, I misunderstood your answer. I will try to keep things like that in mind for the future. As for my defense: Because the code wasnʼt explicitely marked as pseudo code, any future reader of this thread might misconceive it for actual code and get unneccessarily confused. A hint might be appropriate.
Originally Posted by RobinVossen


Reply With Quote