Article View: comp.unix.shell
Article #1404Csh: first character of an arg is '-'
From: Jak Kirman
Date: Sun, 07 Oct 1990 00:25
Date: Sun, 07 Oct 1990 00:25
26 lines
1630 bytes
1630 bytes
Context: SunOS 4.1, /bin/csh
I want to be able to test whether the first character of an argument to
a csh-script is '-'. The man page makes it sound like ~= should work
for this, but I could make no sense of that portion of the man page, and
was not able to find any case where the result of ~= was non-0 except
the trivial case where the right-hand side contained no wildcards and
was the same as the left...
I do *not* want to have to exec a program; I want this to be fast.
Please do not tell me to use sh -- I know it is better for scripts, but
the syntax is rather arcane, and I don't have the time to learn it right
now, although eventually I will probably have to. If you are quite
certain this is not possible in csh, but it is in sh, I would appreciate
a quick example of sh usage.
As an aside, is there any way to find the first character of a word in
csh or sh?
Thanks.
Jak jak@cs.brown.edu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
He had been kicked in the head by a mule when young, and believed
everything he read in the Sunday papers.
-- George Ade
Technical Details
Message-ID:
<JAK.90Oct6202505@bimini.cs.brown.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!brunix!doorknob!jakShow 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: Csh: first character of an arg is '-' Message-ID: <JAK.90Oct6202505@bimini.cs.brown.edu> Date: 7 Oct 90 00:25:05 GMT Sender: news@brunix.UUCP Reply-To: jak@cs.brown.edu Organization: Department of Computer Science, Brown University Lines: 26