in reply to problem with Getopt::Long
Another problem (that isn't with your Getopt::Long), is with your shell scripting. If you want to pass all arguments through to a command in a shell script, it's done like:
rather thancommand "$@"
The difference can be demonstrated if you just take this simple shell script (lets call it "test.sh"):command $*
and call it with some arguments that will demonstrate why this breaks:#!/bin/sh perl -e "use Data::Dumper; print Dumper \@ARGV" $*
but if we change test.sh to:[sstone@ernie1 scratch]$ sh test.sh 1 2 "3 and more stuff" $VAR1 = [ 1, 2, 3, 'and', 'more', 'stuff' ]; [sstone@ernie1 scratch]$
and run it the same way:#!/bin/sh perl -e "use Data::Dumper; print Dumper \@ARGV" "$@"
The difference being that "$@" will preserve the arg list as a list, whereas $* will flatten it all into a string (basically just like join(" ",@ARGV)), and then split it on whitespace... so if you had args with whitespace in them it would get all messed up.[sstone@ernie1 scratch]$ sh test.sh 1 2 "3 and more stuff" $VAR1 = [ 1, 2, '3 and more stuff' ]; [sstone@ernie1 scratch]$
At the very least, that's a couple of things that might be causing you problems.
------------ :Wq Not an editor command: Wq
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: problem with Getopt::Long
by syedtoah (Initiate) on Aug 20, 2004 at 06:59 UTC | |
by syedtoah (Initiate) on Aug 20, 2004 at 07:25 UTC |