Re: $ARGV[0] breaks the script

2006-12-15 Thread Mumia W.
On 12/14/2006 06:24 AM, Gregory Machin wrote: hi the script will not work if I use $ARGV[0] but works 100% if I hard code the $input variable; what have i missed ? #!/usr/bin/perl # if your prgram has the string "grep" in the name or in the path # this program won't work. use strict; use warnin

Re: $ARGV[0] breaks the script

2006-12-15 Thread D. Bolliger
Gregory Machin am Freitag, 15. Dezember 2006 14:05: > On 12/14/06, D. Bolliger <[EMAIL PROTECTED]> wrote: > > Gregory Machin am Donnerstag, 14. Dezember 2006 13:24: [reordered] > > > #!/usr/bin/perl > > > > > > # if your prgram has the string "grep" in the name or in the path > > > # this program

Re: $ARGV[0] breaks the script

2006-12-15 Thread Gregory Machin
Hi thanks for looking at the script.. Just to clarify, the scipt runs perfectly if $input it hardcoded eg $input="httpd". thus if the process is running then it exits, if the process is not running then it exicutes exec "/etc/init.d/$input restart &"; But if I use $input=$ARGV[0] to give the pro

Re: $ARGV[0] breaks the script

2006-12-14 Thread D. Bolliger
Gregory Machin am Donnerstag, 14. Dezember 2006 13:24: > hi Hi Gregory > the script will not work "Not work?" :-) > if I use $ARGV[0] but works 100% if I hard > code the $input variable; > what have i missed ? You can give anything as cmd line argument, and the script will tell you that it i

$ARGV[0] breaks the script

2006-12-14 Thread Gregory Machin
hi the script will not work if I use $ARGV[0] but works 100% if I hard code the $input variable; what have i missed ? #!/usr/bin/perl # if your prgram has the string "grep" in the name or in the path # this program won't work. use strict; use warnings; my $line; my $input; $input=$ARGV[0]; #$i