script problem

Steven Buehler steve at ibushost.com
Thu Dec 13 19:44:16 UTC 2007


> -----Original Message-----
> From: m.roth2006 at rcn.com [mailto:m.roth2006 at rcn.com]
> Sent: Thursday, December 13, 2007 1:22 PM
> To: Steven Buehler
> Subject: RE: script problem
> 
> >Date: Thu, 13 Dec 2007 13:15:40 -0600
> >From: "Steven Buehler" <steve at ibushost.com>
> >
> >Never mind.  A quick search showed me how to do that too.  Thank you
> for
> >your help.
> 
> No problem. I was thinking of a way to do it in shell - maybe
> while
>    $NUM=$NUM+!
>    bu_fil=`awk -v RNUM=$NUM conf.file`
>    tar -cvf ${bu_fil}.tar $bu_fil
> wend
> 
> The perl just seemed the easier tool. As they said, years back in
> SysAdmin, perl: the sysadmin's Swiss Army chainsaw. <g>
> 
>     mark

I agree that perl is more powerful.  I might convert some day when I have
more time.  To add the config file to my shell script, at the top of the
file I just have:
#!/bin/sh
. backup.cfg

That will load it in at the top of my script.  The only problem is that the
script then has to run from the same directory as the config file.  Unless
that line is edited to show the exact location of the cfg file.  But if I do
that, then it defeats the purpose of a config file so people would stay out
of the script file.  I tried running the file from the root directory like
this:
/bin/sh /root/backups/backup.sh
But if I have the include line like I do above, it tries finding the file in
the directory that I am in, not the directory that the script is in.

Steve





More information about the redhat-list mailing list