[Kc] Using Perl
David Nicol
davidnicol at gmail.com
Thu Aug 3 11:56:22 PDT 2006
On 7/31/06, Jay Hannah <jay at jays.net> wrote:
> >
> > LOGFILE="all_server_shutdown.txt" \
> > COMMAND="psshutdown" \
> > CLOPTIONS="-s -t 1 -u ${USERNAME} -p ${PASSWORD}" \
> > /usr/bin/perl -ne 'BEGIN { $d=("-")x5; $r="REM"; $fn=$ENV
> > {LOGFILE}; @cmd=($ENV{COMMAND}." ".$ENV{CLOPTIONS}." \\\\"," >>
> > $fn"); $fl=<>; print "$r ${fl}erase $fn\n"; } next if /^(#)|($r)/;
> > tr/a-z\r\n /A-Z/d; $_=(/^(SVR_)|(other)/i?"$r\n$r [$d$_$d]\n":join
> > ($_, at cmd)."\n"); print;' < $1 > $2
>
> Huh. I can't even get that to run. The error I get:
>
> line 5: $1: ambiguous redirect
the backslashes are suspicious. Don't need backslashes between
env var definitions in bash. Don't need them when entering a
multi-line one-liner
either when its in single-quotes, as this one is. But the \ after the
definition of $ENV{CLOPTIONS} (which one imagines has to do with
tricked-out hooves) will make bash think the following line, where you're
invoking perl, is part of the previous line, so perl doesn't get invoked
at all and the >> redirect, in that case, is in fact ambiguous.
That's my guess. Have a nice day.
--
David L Nicol
"...although it may be / a pile of debris"
More information about the kc
mailing list