It is currently Mon, 25 Sep 2023 12:13:47 GMT



 
Author Message
 command line args and 'if'
Hi,
I am writing a csh script, and want to have an optional command line
argument in the form '-argument'.
Basically I want the usage to be: script [-d] filename

Now the problem I have is that in the script, the 'if' statement does
not seem to like the '-' in the $1 variable (i.e. the script breaks
with a 'if expression syntax error' is there is a '-' in the
appropriate argument)
How would people suggest I get around it?  Is there some way to escape
the '-' (not while invoking the script)?
Remember the -d is optional.

thanks for any help,
Kevin
--
------------------------------------------------------------------------------
Kevin Mocklin                   __/  __/  __/__/  __/ __/  __/__/__/  __/  __/
mock...@twain.ucs.umass.edu    __/__/    __/     __/__/     __/     __/__/__/
University of Massachusetts   __/  __/  __/__/   __/    __/__/__/  __/  __/
------------------------------------------------------------------------------



 Mon, 08 Jan 1996 04:54:38 GMT   
 command line args and 'if'
From article <22kaee$...@nic.umass.edu>, by mock...@twain.ucs.umass.edu (Kevin A. Mocklin):

        if [ "x$1" = "x-d" ]



 Mon, 08 Jan 1996 21:10:54 GMT   
 
   [ 2 post ] 

Similar Threads

1. CGI commands with command line args?

2. 'route' command reports only 1 line

3. Hide command line arguments from 'ps'

4. Hide command line arguments from 'ps'

5. command line broken in 'w'...

6. RE : DIFFICULT: Can't execute system command from FVWM, but can from the command line

7. PS1 Line and the 'pwd' command

8. how to set argv command line args for ps


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software