------_=_NextPart_001_01C54075.E7225C28 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I have a script that is reading input from ARGV. The script is being passed a file name as follows: =20 datefile.pl c:\program files\IBM\SQLLIB\DB2\db2diag.log =20 The problem I am running into is that the space is not recognized in the argument. All that I get passed to is is c:\program . How do I get the rest of the argument. Below is a portion of the script. Thanks. =20 #*********************************************** # check input parameter * #*********************************************** $arg_length =3D length($ARGV[0]); $arg_lastchar =3D substr($ARGV[0], $arg_length-1, 1); $arg_string =3D $ARGV[0] ; print "Parameter argument is: $arg_string "; ------_=_NextPart_001_01C54075.E7225C28-- |
||||||||
|
![]() |
4/13/2005 10:12:38 PM |
Subject: Passing command line arguments I have a script that is reading input from ARGV. The script is being passed a file name as follows: datefile.pl c:\program files\IBM\SQLLIB\DB2\db2diag.log The problem I am running into is that the space is not recognized in the argument. All that I get passed to is is c:\program . How do I get the rest of the argument. Below is a portion of the script. Thanks. #*********************************************** # check input parameter * #*********************************************** $arg_length = length($ARGV[0]); $arg_lastchar = substr($ARGV[0], $arg_length-1, 1); $arg_string = $ARGV[0] ; print "Parameter argument is: $arg_string "; SUN1-BATCH>./foo "1 2 3" 4 5 6 Number of parameters = <4> 1 2 3 SUN1-BATCH>more foo #!/usr/bin/perl print "Number of parameters = <" . scalar(@ARGV) . "> " if (scalar(@ARGV)); print $ARGV[0], " "; SUN1-BATCH> Hope this gives you some ideas... jwm |
||||||||
|
![]() |
4/13/2005 10:18:17 PM |
On Wednesday 13 April 2005 11:12 pm, Bret Goodfellow wrote: > I have a script that is reading input from ARGV. The script is being > passed a file name as follows: > > datefile.pl c:\program files\IBM\SQLLIB\DB2\db2diag.log You could paste the two arguments together in perl, add a space between them, and use that as the filename. Or you could just quote the argument: datefile.pl "c:\program files\IBM\SQLLIB\DB2\db2diag.log" |
||||||||
|
![]() |
4/14/2005 ****:03 PM |
Stephen Day wrote: > On Wednesday 13 April 2005 11:12 pm, Bret Goodfellow wrote: > >>I have a script that is reading input from ARGV. The script is being >>passed a file name as follows: >> >>datefile.pl c:\program files\IBM\SQLLIB\DB2\db2diag.log > > You could paste the two arguments together in perl, add > a space between them, and use that as the filename. What if there are two or more spaces? A TAB character? John -- use Perl; program fulfillment |
||||||||
|
![]() |
4/14/2005 11:18:28 PM |
On Friday 15 April 2005 12:18 am, John W. Krahn wrote: > >>datefile.pl c:\program files\IBM\SQLLIB\DB2\db2diag.log > > > > You could paste the two arguments together in perl, add > > a space between them, and use that as the filename. > > What if there are two or more spaces? A TAB character? Then it would totally mess up. I was trying to say you could do a complex thing, but it's better to just quote the argument and not face the problem in the first place. |
||||||||
|
![]() |
4/14/2005 11:32:50 PM |
On 4/13/05, Bret Goodfellow |
||||||||
|
![]() |
4/14/2005 11:37:41 PM |