[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] [Kc] Using Perl



Jay, Just a guess,

didn't terminate the password statement correctly... BTW nice script though...

Jay Hannah wrote:

Garrett Goebel wrote:
Well, perhaps you'd like to submit a "best practices" version?

Before:

bash-2.03# cat build_all_server_shutdown.sh
#!/bin/bash
USERNAME="username"
PASSWORD="password"

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 ($_,@cmd)."\n"); print;' < $1 > $2

Huh. I can't even get that to run. The error I get:

  line 5: $1: ambiguous redirect

Its basically generating a file to disk? Can you post a sample file?

j

_______________________________________________
Omaha-pm mailing list
Omaha-pm@pm.org
http://mail.pm.org/mailman/listinfo/omaha-pm