Visit The New, Modern Unix Linux Community

Recognizing an argument in csh

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Recognizing an argument in csh
# 1  
Recognizing an argument in csh

I will be passing an argument to a csh script

The script can be either of two forms

For example, either

script.csh zloc=5/10

script.csh zloc=5/10/20

So there can be either two values or three values. How can I distinguish which one the user has inputted?

I have made some code that gives me the string after the '='. That is, I have a variable having 5/10 or 5/10/20
# 2  
well, other than a caveat that coding in csh is not generally the preferred option...

how about:

#  echo "5/10" | awk -F/ '{print NF}'

#  echo "5/10/20" | awk -F/ '{print NF}'


Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #44
Difficulty: Easy
Data moves through the Internet in a data structure called a 'packet'.
True or False?

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Recognizing storage from server

Hi, I need to know what are the storages attached to some of our corporate servers. I run this command from the server only to get a list of WWNs : # /usr/local/bin/evainfo -a Devicefile Array WWNN Capacity ... (1 Reply)
Discussion started by: anaigini45
1 Replies

2. UNIX for Advanced & Expert Users

Error:--test: argument expected--Even though i give an argument.

Hi All, I am running the script VBoxManage list vms |sed 's/"//g' | cut -d " " -f1 > har1out.mytxt result=`cat har1out.mytxt | grep $1' echo $result echo $1 { if then echo pass else echo fail fi (2 Replies)
Discussion started by: harsha85
2 Replies

3. Red Hat

VMBox not Recognizing eth0 on RH.

Hello, I re-installed my laptop and installed a new copy of VMBOX, I created a VM Machine with my Rhel5 and a CEntos copy as well. I am using a laptop HP DV4, I use wireless on the laptop. Usually when I boot up in to either machine I would get eht0 and lo as usual now I just don't get... (4 Replies)
Discussion started by: NelsonC
4 Replies

4. Shell Programming and Scripting

Help on command line argument in csh

HI , I am new to csh. I need to pass some command line arguments like ./ -os Linux -path abc -tl aa -PILX 1 I have defined the loop as shown below. But its taking "-os" switches as arguments. Its treating them as arguments. How to resolve it? while ( $#argv != 0 ) switch ($argv) ... (7 Replies)
Discussion started by: vineet.dhingra
7 Replies

5. Shell Programming and Scripting

csh shell script 'set' argument limit?

Hi , I have a script that is causing a problem that led me to think if there is a limit to the number of arguments for 'set' command in csh shell script. Here is my script: #!/bin/csh -f set top = design_top #1 set v_mbist = ( sim_mbist/*.v ) #2 set v_simlist = ( -v... (2 Replies)
Discussion started by: return_user
2 Replies

6. Shell Programming and Scripting

Cannot compare argument in if statement in csh/grep command if argument starts with -

If ($argv == “-debug”) then Echo “in loop” Endif But this is not working. If I modify this code and remove “-“, then it works. Similarly I am getting problem using grep command also Grep “-debug” Filename Can someone please help me on how to resolve these... (1 Reply)
Discussion started by: sarbjit
1 Replies

7. Shell Programming and Scripting

get positive number n as argument script must calculate the factorial of its argument

Can someone please help me with this SHELL script? I need to create a script that gets a positive number n as an argument. The script must calculate the factorial of its argument. In other words, it must calculate n!=1x2x3x...xn. Note that 0!=1. Here is a start but I have no clue how to... (3 Replies)
Discussion started by: I-1
3 Replies

8. 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

9. Shell Programming and Scripting

recognizing *.* in find

hi folks, I am trying to write a script for deleting all the files which are older than "N" days from current directory. CODE: FileName="*.*" NumDays=-1 echo $FileName echo $NumDays find * -prune -name $FileName -mtime $NumDays -exec rm {} \; Now the problem here is when i... (3 Replies)
Discussion started by: amarnath
3 Replies

10. Shell Programming and Scripting

recognizing * character

i have a short script that takes a filename and secure copies the file to a remote machine. i'd like to be able to take a * character and secure copy all the files in the directory. first of all, how would i compare $1 to see if it's a * character? if or didn't do it. second question is... (3 Replies)
Discussion started by: csejl
3 Replies

Featured Tech Videos