[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Scripting help
- From: "Anand Buddhdev" <arb anand org>
- To: redhat-list redhat com
- Subject: Re: Scripting help
- Date: Sat Mar 29 06:02:01 2003
[cut]
> But things like checking for zip return error codes, mounting the share
> error codes etc. is new to me. Obviously if the share is unable to be
> mounted, I'd like to skip the rest of the steps and echo "Backup PC could
> not be mounted - error code <such and such> >> backuplog.txt". And then
drop
> out.
>
> Also, it would be nice to name the backup 20030329.zip for example. So
> things like extracting the date from the system is also beyond me.
>
> Anyone know of a good tutorial on the web to help me learn these few
things?
In sh/bash, the variable $? holds the exit value of the last command to run.
So you
can do:
mount ....
if [$? -ne 0]
then
echo "command failed"
... more stuff ...
fi
"man bash" and "man test" for more information.
For extracting the date in the format you like, try:
date '+%Y%m%d'
"man date" for more information.
And there are loads of online tutorials on shell scripting. Google turned up
one such
tutorial for me:
http://www.freeos.com/guides/lsst/
There must be others too.
--
Anand
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]