o
such mechanism exists for cmd.exe that I am aware of. %* is
substituted for the command line arguments, but they aren't
quoted or escaped so they are not preserved. You could hard-code
up to 9 arguments with "%1" "%2" ... "%n", but then you'll be
passing always
Hi Brandon,
Thanks ... using the cat and pipe looks "cleaner" ... I will try that one
... thanks
On Fri, Jul 23, 2010 at 4:53 AM, Brandon McCaig wrote:
> On Wed, Jul 21, 2010 at 1:17 PM, newbie01 perl
> wrote:
> > Does $_ contains the following values on each iteration?
> >
> > mail_smtp.pl
>
On Wed, Jul 21, 2010 at 1:17 PM, newbie01 perl wrote:
> Does $_ contains the following values on each iteration?
>
> mail_smtp.pl
> -r
> ${MAILFROM}
> -s
> "$subject_line TEST EMAIL"
> supportm...@test.com
> <
> /tmp/test_email.txt
Just to clarify the end of the command line:
mail_smtp.pl -r ${M
"$subject_line TEST EMAIL"
supportm...@test.com< /tmp/test_email.txt
The Perl script is working and SMTP mail is working. Am just trying to
understand how the getval sub-routine is parsing the command line arguments.
the getval subroutin
led from a
> UNIX Korn script as below:
>
> mail_smtp.pl -r ${MAILFROM} -s "$subject_line TEST EMAIL"
> supportm...@test.com < /tmp/test_email.txt
>
> The Perl script is working and SMTP mail is working. Am just trying to
> understand how the getval sub-routine is par
EMAIL"
supportm...@test.com < /tmp/test_email.txt
The Perl script is working and SMTP mail is working. Am just trying to
understand how the getval sub-routine is parsing the command line arguments.
the getval subroutine is as below.
perl pra wrote:
hi All,
I have to call some perl scripts with command line arguements from another
perl script.
(some thing like this)
perl -s -a $ENV{X} -b $ENV{Y} -c $ENV{Z} ; ( -a , -b, -c are also the
arguments to call the script)
( the $ENV{x}=C:\xyz\abc,$ENV{Y}=abc,$ENV{Z}=5).
hi All,
I have to call some perl scripts with command line arguements from another
perl script.
(some thing like this)
perl -s -a $ENV{X} -b $ENV{Y} -c $ENV{Z} ; ( -a , -b, -c are also the
arguments to call the script)
( the $ENV{x}=C:\xyz\abc,$ENV{Y}=abc,$ENV{Z}=5).
I understand we
Am Freitag, 29. April 2005 11.22 schrieb lohit:
> On 4/29/05, John Doe <[EMAIL PROTECTED]> wrote:
> > Am Freitag, 29. April 2005 10.19 schrieb lohit:
> > > On 4/29/05, John Doe <[EMAIL PROTECTED]> wrote:
> > > > Am Freitag, 29. April 2005 09.19 schrieb lohit:
> > > > > On 4/29/05, lohit <[EMAIL PRO
On 4/29/05, John Doe <[EMAIL PROTECTED]> wrote:
>
> Am Freitag, 29. April 2005 10.19 schrieb lohit:
> > On 4/29/05, John Doe <[EMAIL PROTECTED]> wrote:
> > > Am Freitag, 29. April 2005 09.19 schrieb lohit:
> > > > On 4/29/05, lohit <[EMAIL PROTECTED]> wrote:
> > > > > Hi,
> > >
> > > Hi
> > >
> >
Am Freitag, 29. April 2005 10.19 schrieb lohit:
> On 4/29/05, John Doe <[EMAIL PROTECTED]> wrote:
> > Am Freitag, 29. April 2005 09.19 schrieb lohit:
> > > On 4/29/05, lohit <[EMAIL PROTECTED]> wrote:
> > > > Hi,
> >
> > Hi
> >
> > > > i have a requirement, as in based on one command line option, t
On 4/29/05, John Doe <[EMAIL PROTECTED]> wrote:
>
> Am Freitag, 29. April 2005 09.19 schrieb lohit:
> > On 4/29/05, lohit <[EMAIL PROTECTED]> wrote:
> > > Hi,
>
> Hi
>
> > > i have a requirement, as in based on one command line option, the rest
> > > of the arguments change for the same script.
Am Freitag, 29. April 2005 09.19 schrieb lohit:
> On 4/29/05, lohit <[EMAIL PROTECTED]> wrote:
> > Hi,
Hi
> > i have a requirement, as in based on one command line option, the rest
> > of the arguments change for the same script.
> > eg: script could be called in either of the ways
> > script1 -
On 4/29/05, lohit <[EMAIL PROTECTED]> wrote:
>
> Hi,
> i have a requirement, as in based on one command line option, the rest of
> the arguments change for the same script.
> eg: script could be called in either of the ways
> script1 -option1 -option2 adfas -option3
> script -option1 -option4
Hi,
i have a requirement, as in based on one command line option, the rest of
the arguments change for the same script.
eg: script could be called in either of the ways
script1 -option1 -option2 adfas -option3
script -option1 -option4
my question is
1. how do we get the option1 alone from GetO
On 4/13/05, Bret Goodfellow <[EMAIL PROTECTED]> 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
>
> The problem I am running into is that the space is not recognized in the
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?
Th
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
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 t
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
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
From: "Dennis G. Wicks" <[EMAIL PROTECTED]>
> I just did extensive testing using ActiveState perl on XP-Pro
> and I get the exact same results.
>
> C:\DATAFI~1>argv.pl testfile
>
> gives the unitialized variable message but
>
> C:\DATAFI~1>perl argv.pl testfile
>
> works as expected.
It ain'
08:29:45 -0400 (EDT)
> > From: Jeff 'japhy' Pinyan <[EMAIL PROTECTED]>
> > Reply-To: [EMAIL PROTECTED]
> > To: Larry Wissink <[EMAIL PROTECTED]>
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: Confused about supplying command line argum
#x27;s just confusing that it works that way and not the
other...
Thanks very much for the suggestion. It was so frustrating since every
example/documentation assumes you can simply supply command-line
arguments. (And it should be that simple.)
-Original Message-
From: Jeff 'japh
400 (EDT)
> From: Jeff 'japhy' Pinyan <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: Larry Wissink <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: Confused about supplying command line arguments and using
> @ARGV
>
> On Jun 2, Larry
On Jun 2, Larry Wissink said:
>I want to supply the name of a file on the command line when executing a
>script. Unfortunately, I'm getting an error that says that @ARGV is
>uninitialized.
>
>How do you initialize @ARGV? How do you specify command line arguments?
You do
Hi,
I thought this would be simple...
I want to supply the name of a file on the command line when executing a
script. Unfortunately, I'm getting an error that says that @ARGV is
uninitialized.
How do you initialize @ARGV? How do you specify command line arguments?
I'm using
Chris Ball wrote:
>
> > "Sailaja" == Sailaja Gudipati <[EMAIL PROTECTED]> writes:
>
> Sailaja> if($ARGV[0] !~ /-f/) print "Wrong switch";
>
> This looks fine, though you need braces around the print statement.
> Also note that 'foo-fbar' matches this regexp. I'd use:
>
> if ($ARGV
e not allowed" }
should work just fine. _However_, this is already being picked up by
your check on the number of elements in @ARGV, since an empty string
won't appear as an array element.
Sailaja> But, since @ARGV is empty, I am unable to validate the
Sailaja> command line
me know how to use
$USAGE also.
The following is the pseudo code I want to use by
using @ARGV.
if($ARGV[0] !~ /-f/) print "Wrong switch";
if($ARGV[1]) !~ //) print "Empty file name not
allowed";
But, since @ARGV is empty, I am unable to validate the
command line arguments.
P
From: Nikola Janceski <[EMAIL PROTECTED]>
> Is there a way to get the command line arguments before they are
> expanded by the shell?
>
> script.pl file* names*
>
> I want to get the file* and not the expanded list of file1 file2 file3
> file4 etc.
>
> I k
--Original Message-
From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 5:08 PM
To: Hanson, Robert; Nikola Janceski; Beginners (E-mail)
Subject: RE: command line arguments
I was hoping for some way to capture it in perl instead with out having to
change the co
>>>>> "Nikola" == Nikola Janceski <[EMAIL PROTECTED]> writes:
Nikola> Is there a way to get the command line arguments before they
Nikola> are expanded by the shell?
Nope. Perl simply doesn't get to see them. It's part of your
interactio
I was hoping for some way to capture it in perl instead with out having to
change the command line arguments.
-Original Message-
From: Hanson, Robert [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 5:05 PM
To: 'Nikola Janceski'; Beginners (E-mail)
Subject: RE: co
il)
Subject: command line arguments
Is there a way to get the command line arguments before they are expanded by
the shell?
script.pl file* names*
I want to get the file* and not the expanded list of file1 file2 file3 file4
etc.
I know I can put it in quotes but is there any other way around it?
Is there a way to get the command line arguments before they are expanded by
the shell?
script.pl file* names*
I want to get the file* and not the expanded list of file1 file2 file3 file4
etc.
I know I can put it in quotes but is there any other way around it?
Delivery Queue
<http://
[EMAIL PROTECTED] wrote:
>
> This script gives me nothing:
>
> #!/usr/bin/perl -F/\t/ -ap
>
> print @F[14 .. 17] if $F[0] eq "H" and $F[5] = 1816;
^
> print @F[14 .. 17] if $F[0] eq "H" and $F[5] = 5380;
This script gives me nothing:
#!/usr/bin/perl -F/\t/ -ap
print @F[14 .. 17] if $F[0] eq "H" and $F[5] = 1816;
print @F[14 .. 17] if $F[0] eq "H" and $F[5] = 5380;
print @F[14 .. 17] if $F[0] eq "H" and $F[5] = 5370;
The file is indeed tab delimited, and the sixth field should have a number
in
On Tue, 20 Nov 2001 23:50:54 -0500, you wrote:
my @args = @ARGV;
@ARGV contains the command line parameter.
martin
>In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED] (Nicolae Popovici) wrote:
>
>> Hi guys,
>>
>> Can anyone tell me how can I take the
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Nicolae Popovici) wrote:
> Hi guys,
>
> Can anyone tell me how can I take the command line arguments in a perl
> script . I forgot how to do it .
> Thanks for your support .
Couple ways.
process a loop around @A
The command-line arguments are stored in the built-in @ARGV array.
Therefore, if you say something like :
perl sample.pl argument1 argument2 argument3
then in your program you can access each of the command-line arguments as
follows
print $ARGV[0]; #prints argument1
print $ARGV[1]; #prints
Hi guys,
Can anyone tell me how can I take the command line arguments in a perl
script . I forgot how to do it .
Thanks for your support .
Regards,
Nick
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
1]\n";# 2nd command line argument.
print "Count is: $count\n";# Number of arguments.
carp "Not enough arguments to get started" unless $count > 0;
@ARGV stores command line arguments.
For more sophisticated command line support, look at the GetOpt modules.
HTH,
Martin
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Command line arguments are passed to the script in the array '@ARGV', not
'@_'. '@_' is used for subroutines.
-Original Message-
From: Bob Bondi [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 19, 2001 12:51 PM
To: [EMAIL PROTECTED]
Subject: Help: Start
My question is: how can I pass arguments to a script from the command line?
The script at the tail of this message is what I thought would print the 2
arguments I passed into the script, yet the output for this snippet is:
Here ya go:
Here ya go:
Count is: 0
Not enough arguments to get started
#\
On Mon, 4 Jun 2001, Paul <[EMAIL PROTECTED]> wrote,
> --- George Petri <[EMAIL PROTECTED]> wrote:
>
> > "When you launch a script from the command line, for example, @_
> > populates with all of the parameters passed in through the command
> > line"
>
> Typo. @ARGV is correct, as you already
--- George Petri <[EMAIL PROTECTED]> wrote:
> "When you launch a script from the command line, for example, @_
> populates with all of the parameters passed in through the command
> line"
Typo. @ARGV is correct, as you already figured out. =o)
__
On Jun 4, Tony Cook said:
>On Mon, 4 Jun 2001, George Petri wrote:
>
>>
>> In a book called "Open Source Linux Web Porgramming" by Jones and Batchelor,
>> it says (on Page 61):
>
>If your book says this, then it's wrong on 2 counts, both of which you
>seem to have discovered yourself:
Perhaps
I use "shift @_" (since @_ is
> supposedly used by default anyway), I do not get the command line
> arguments.
>
> However, if I use "shift @ARGV", I DO get the command line arguments.
> If the shift function really does use @_ as its default argument,
> then why
rameters passed in through the command line. The shift
> function, among others, will use @_ by default if no other array is provided.
This is, as your experimentation has shown, false. Command-line arguments
populate @ARGV. The description of shift is correct, but only in certain
situatio
George Petri wrote:
> However, if I use "shift @ARGV", I DO get the command line arguments. If the
> shift function really does use @_ as its default argument, then why did shift
> in the example code, use @ARGV as default? Does @_ really get populated
> "with all
On Mon, 4 Jun 2001, George Petri wrote:
>
> Hi!
>
> In a book called "Open Source Linux Web Porgramming" by Jones and Batchelor,
> it says (on Page 61):
>
> "When you launch a script from the command line, for example, @_ populates
> with all of the parameters passed in through the command l
will use @_ by default if no other array is provided.
#!/usr/bin/perl
@firstCommandLineArg=shift;
@secondCommandLineArg=shift;"
The provided code snipplet works but if I use "shift @_" (since @_ is
supposedly used by default anyway), I do not get the command line
arguments.
Howe
53 matches
Mail list logo