🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1414

Re: Csh: first character of an arg is '-': Solution

#1414
From: Jak Kirman
Date: Sun, 07 Oct 1990 15:54
20 lines
1426 bytes
The test to see whether the first character of $i was '-' should have
been 

if ( x$i =~ x-* ) then          not
if ( $i =~ -* ) then

Several of the original replies used this, but I mistakenly thought it
was unnecessary, since it worked without it too.  But as was pointed out
to me, if $i has a special meaning to the shell, like -e or -x etc, it
will complain about the lack of a filename to do the existence or
executability test on.  Adding something like an 'x' or a " " before
both tests will solve this problem.

Sorry about the incorrect simplification of your answers :-)

                                Jak                            jak@cs.brown.edu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For the female of the species is more deadly than the male.
                                     -- Kipling, "The Female of the Species"
Technical Details
Message-ID: <JAK.90Oct7115458@bimini.cs.brown.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!brunix!doorknob!jak
References: <JAK.90Oct7001815@bimini.cs.brown.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!brunix!doorknob!jak
From: jak@cs.brown.edu (Jak Kirman)
Newsgroups: comp.unix.shell
Subject: Re: Csh: first character of an arg is '-': Solution
Message-ID: <JAK.90Oct7115458@bimini.cs.brown.edu>
Date: 7 Oct 90 15:54:58 GMT
References: <JAK.90Oct7001815@bimini.cs.brown.edu>
Sender: news@brunix.UUCP
Reply-To: jak@cs.brown.edu
Distribution: comp
Organization: Department of Computer Science, Brown University
Lines: 20
In-reply-to: jak@cs.brown.edu's message of 7 Oct 90 04:18:15 GMT