Sponsored Content
Full Discussion: $#Argv in Csh
Top Forums Shell Programming and Scripting $#Argv in Csh Post 302362942 by new2C on Monday 19th of October 2009 12:41:50 AM
Old 10-19-2009
$#Argv in Csh

Hello all,

Had a quick question:

In a typical csh script should inputting via stdin (i.e. set i = $< ) increase the value of $#argv ?

Code:
echo enter an value:
set val= "$<"


if($#argv == 0) then
  echo No args

else
   echo The arg is $argv[1]

so if a value is inputted #argv shouldn't be zero? Thanks.

---------- Post updated at 11:32 PM ---------- Previous update was at 11:08 PM ----------

What changes the value of $#argv?

---------- Post updated at 11:41 PM ---------- Previous update was at 11:32 PM ----------

passing the value on the command line?
 

10 More Discussions You Might Find Interesting

1. Programming

argv

I have a program which I wish to modify. It used to be run from the command line, but now I wish to change this so it can be used as a function. The program has complex argument processing so I want to pass my paramters to as if it were being called by the OS as a program. I have tried to... (2 Replies)
Discussion started by: mbb
2 Replies

2. Programming

Using argv argc

I searched on the forums. No advises. I am using a previous source code. I changed the main function main(int argc, char **argv) in a function misc(int argc, char **argv). How do you use the argc and argv parameters? This is how I am calling the function : char param; strcat(param,"wgrib ");... (4 Replies)
Discussion started by: Akeson Chihiro
4 Replies

3. Programming

help for argv argc

Hi C experts, I have the following code for adding command line option for a program int main (argc, argv) int argc; char *argv; { char *mem_type; //memory type char *name; //name of the memory int addr; //address bits int data; ... (5 Replies)
Discussion started by: return_user
5 Replies

4. Shell Programming and Scripting

if #argv = (this OR that) then...

this is in one of my scripts... if ($#argv == 0) then echo 'blah bla' exit 0 endif I want it to be something like this... if ($#argv == 0 OR $argv >=3) echo 'blah bla' exit 0 endif so when the arguments are none, or greater than three I want this "if then" to take over. how? I... (5 Replies)
Discussion started by: ajp7701
5 Replies

5. Shell Programming and Scripting

csh failing to call an 2 embedded csh script

I have an extraordinary problem with a csh script.....(feel free to berate the use of this but I'm modifying an existing bunch of them) Anyway, I have a master csh script which in turn calls a second csh script. This second csh script is below. Within this second script are two compiled C++... (1 Reply)
Discussion started by: pollsizer
1 Replies

6. Programming

ARGV help in C

Hi, Can somehelp help how to list file in a dir? (5 Replies)
Discussion started by: Learnerabc
5 Replies

7. Programming

help with C, argv

when i run my program, i have a parameter, that i want to set the value to another string i am using int main(int argc, char **argv) { char my_str=argv; printf("%s",my_str); return 0; } and i get Segmentation fault ran using ./my_prog /usr/share/dict/words hello1 ... (2 Replies)
Discussion started by: omega666
2 Replies

8. Shell Programming and Scripting

argv in csh [solved]

I have a problem that when I run my script with no arguments I get the error argv: Subscript out of range. #!/bin/csh set rdir = "/uniprg/chrisd/radon/trunk-radon/fradon/source-frt/new-frt" if ($#argv == 0) then echo "no arguments passed to radon3d-linear.com" ... (0 Replies)
Discussion started by: kristinu
0 Replies

9. UNIX for Advanced & Expert Users

O argv, argv, wherefore art thou argv?

All of my machines (various open source derivatives on x86 and amd64) store argv above the stack (at a higher memory address). I am curious to learn if any systems store argv below the stack (at a lower memory address). I am particularly interested in proprietary Unices, such as Solaris, HP-UX,... (9 Replies)
Discussion started by: alister
9 Replies

10. UNIX for Dummies Questions & Answers

ARGV how to use it?

So i am trying to read in file readFile <GivenFile> modFile looking for a regular file under the directories in the GivenFile and print them out is my over all goal. basically I am looking for anything that looks like a directory in the given file and printing it out. Since I am trying to do... (2 Replies)
Discussion started by: squidGreen
2 Replies
IMAP_RFC822_PARSE_ADRLIST(3)						 1					      IMAP_RFC822_PARSE_ADRLIST(3)

imap_rfc822_parse_adrlist - Parses an address string

SYNOPSIS
array imap_rfc822_parse_adrlist (string $address, string $default_host) DESCRIPTION
Parses the address string as defined in RFC2822 and for each address. PARAMETERS
o $address - A string containing addresses o $default_host - The default host name RETURN VALUES
Returns an array of objects. The objects properties are: o mailbox - the mailbox name (username) o host - the host name o personal - the personal name o adl - at domain source route EXAMPLES
Example #1 imap_rfc822_parse_adrlist(3) example <?php $address_string = "Joe Doe <doe@example.com>, postmaster@example.com, root"; $address_array = imap_rfc822_parse_adrlist($address_string, "example.com"); if (!is_array($address_array) || count($address_array) < 1) { die("something is wrong "); } foreach ($address_array as $id => $val) { echo "# $id "; echo " mailbox : " . $val->mailbox . " "; echo " host : " . $val->host . " "; echo " personal: " . $val->personal . " "; echo " adl : " . $val->adl . " "; } ?> The above example will output: # 0 mailbox : doe host : example.com personal: Joe Doe adl : # 1 mailbox : postmaster host : example.com personal: adl : # 2 mailbox : root host : example.com personal: adl : SEE ALSO
imap_rfc822_parse_headers(3). PHP Documentation Group IMAP_RFC822_PARSE_ADRLIST(3)
All times are GMT -4. The time now is 04:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy