
Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [tlug] cron and lftp problems
- Date: Wed, 26 Jan 2005 07:07:21 -0800 (PST)
- From: Jake Morrison <jake_morrison@example.com>
- Subject: Re: [tlug] cron and lftp problems
--- Josh Glover <jmglov@example.com> wrote:
>
> I put a bunch of "constants" at the top of my scripts:
>
> AWK=/bin/awk
> CAT=/bin/cat
> GREP=/bin/grep
> SCP=/usr/bin/scp
> SED=/bin/sed
> SSH=/usr/bin/ssh
>
> And then, my commands look like this:
>
> servers=`${CAT} ${file} | ${SED} -e 's/\t/ /g' | ${AWK} '{ print $1
> }'`
> for i in ${servers}; do
> ${SSH} $i ${GREP} foo ${foofile}
> if [ $? -ne 0 ]; then
> ${SCP} ${foofile} $i:${foofile}
> fi
> done
>
> -Josh
Josh, don't scare the guy :-)
Actually, variables are a great idea. But I don't end up using
them that much for commands in shell scripts. I find that if
the script gets complicated enough that I need some specific
feature of grep or tar that only exists in the GNU version
(installed in /usr/local or /opt or ...), it is probably better
just to rewrite it in perl or python.
Makefiles, on the other hand....
Jake
Home |
Main Index |
Thread Index