[comp.unix.shell] echo question

simonl@bnr.ca (Simon-Cheuk Leung) (03/08/91)

   I have a question on C-shell, if I do the following,

        set item = ( search 'find / -name "\!*" -print' )
   
   I can set this item without getting any complain, but it doesn't allow me 
   echoing $item[2]. How can I echo the original $item[2] in this case? 
   (include \!*)
   Any comments? 

   Thanks in advance ....

-- 
  +-------------------------+-----------------------+------------------------+
  |  Simon C. F. Leung      | Bitnet: simonl@bnr.ca |  Phone: (613) 763-9077 |
  |  Bell-Northern Research.| UUCP  : ..uunet!bnrgate!bcara222!simonl        |
  |__Ottawa,  Canada________|________________________________________________|                   
-- 
  +-------------------------+-----------------------+------------------------+
  |  Simon C. F. Leung      | Bitnet: simonl@bnr.ca |  Phone: (613) 763-9077 |
  |  Bell-Northern Research.| UUCP  : ..uunet!bnrgate!bcara222!simonl        |
  |__Ottawa,  Canada________|________________________________________________|                   

tchrist@convex.COM (Tom Christiansen) (03/08/91)

From the keyboard of simonl@bnr.ca (Simon-Cheuk Leung):
:
:   I have a question on C-shell, if I do the following,
:
:        set item = ( search 'find / -name "\!*" -print' )
:   
:   I can set this item without getting any complain, but it doesn't allow me 
:   echoing $item[2]. How can I echo the original $item[2] in this case? 
:   (include \!*)

You need to either enclose it in double quotes:

    echo "$item[2]"

or turn off globbing with "set noglob" or at least the whining with 
"set nonomatch".  You will lose the backslash, but that's ok.

What's not ok is that you use the csh, which is a royal pain the neck, and
you shouldn't be using it for didly squat.   I know  "should" is a strong
word that we "shouldn't" use, but so be it.  Bill Joy has a plane of hell
reserved all to himself because of the csh.  Use a real shell, or perl, but
break yourself of the csh sickness before it becomes terminal.

--tom

ramsey@NPIRS.Purdue.EDU (Ed Ramsey) (03/09/91)

From article <1991Mar08.142000.27880@convex.com>, by tchrist@convex.COM (Tom Christiansen):
> From the keyboard of simonl@bnr.ca (Simon-Cheuk Leung):
> :
> :   I have a question on C-shell, if I do the following,
> ...
 
> What's not ok is that you use the csh, which is a royal pain the neck, and
> you shouldn't be using it for didly squat.   I know  "should" is a strong
> word that we "shouldn't" use, but so be it.  Bill Joy has a plane of hell
> reserved all to himself because of the csh.  Use a real shell, or perl, but
> break yourself of the csh sickness before it becomes terminal.

Which shell, then?

-Ed

asg@sage.cc.purdue.edu (Bruce Varney) (03/09/91)

In article <1991Mar8.163037.18947@NPIRS.Purdue.EDU> ramsey@NPIRS.Purdue.EDU (Ed Ramsey) writes:
>From article <1991Mar08.142000.27880@convex.com>, by tchrist@convex.COM (Tom Christiansen):
>> From the keyboard of simonl@bnr.ca (Simon-Cheuk Leung):
>> :
>> :   I have a question on C-shell, if I do the following,
>> ...
> 
>> What's not ok is that you use the csh, which is a royal pain the neck, and
>>                                              Use a real shell, or perl, but
>> break yourself of the csh sickness before it becomes terminal.
>
>Which shell, then?

bash!!!!!!! :-)

>
>-Ed

---------
sar.casm \'sa:r-.kaz-*m\ \sa:r-'kas-tik\ \-ti-k(*-)le-\ n [F sarcasme, fr. 
   LL sarcasmos, fr. Gk sarkasmos, fr. sarkazein to tear flesh, bite the lips 
   in rage, sneer, fr. sark-, sarx flesh; akin to Av thwar*s to cut] 1: a 
   cutting, hostile, or contemptuous remark : GIBE 2: the use of caustic or 
   ironic language - sar.cas.tic aj

                                   ###             ##
Courtesy of Bruce Varney           ###               #
aka -> The Grand Master                               #
asg@sage.cc.purdue.edu             ###    #####       #
PUCC                               ###                #
;-)                                 #                #
;'>                                #               ##

tchrist@convex.COM (Tom Christiansen) (03/09/91)

From the keyboard of ramsey@NPIRS.Purdue.EDU (Ed Ramsey):
:Which shell, then?

One that's sh compatible.  sh itself is pretty bare-bones, but still
better csh by a parsec or three.  There's also the BRL shell, ksh, or bash.

--tom

byron@archone.tamu.edu (Byron Rakitzis) (03/09/91)

In article <1991Mar08.180955.12077@convex.com> tchrist@convex.COM (Tom Christiansen) writes:
>From the keyboard of ramsey@NPIRS.Purdue.EDU (Ed Ramsey):
>:Which shell, then?
>
>One that's sh compatible.  sh itself is pretty bare-bones, but still
>better csh by a parsec or three.  There's also the BRL shell, ksh, or bash.
>
>--tom

If you want a shell that's slightly less bare-bones than sh, but still
pretty tiny, consider rc, the at&t plan 9 shell. I've created my own
public implementation of this shell. See the relevant articles in
comp.archives, comp.lang.misc and comp.unix.shell. (Gee, that's this
group!)

Byron.

--
"Never put off till tomorrow what you can avoid all together."

src@scuzzy.in-berlin.de (Heiko Blume) (03/09/91)

tchrist@convex.COM (Tom Christiansen) writes:

>From the keyboard of ramsey@NPIRS.Purdue.EDU (Ed Ramsey):
>:Which shell, then?

>One that's sh compatible.  sh itself is pretty bare-bones, but still
>better csh by a parsec or three.  There's also the BRL shell, ksh, or bash.

has anyone looked at the rc-shell (plan 9 shell lookalike) announced
recently? the posting said it's like C but clean/easy/small etc,
and has a yacc-generated parser. sounds like a real alternative to csh
programming. (btw: sh programming also isn't what i'd call terrific :-)
-- 
      Heiko Blume <-+-> src@scuzzy.in-berlin.de <-+-> (+49 30) 691 88 93
                  public UNIX source archive [HST V.42bis]:
        scuzzy Any ACU,f 38400 6919520 gin:--gin: nuucp sword: nuucp
                     uucp scuzzy!/src/README /your/home

cks@hawkwind.utcs.toronto.edu (Chris Siebenmann) (03/09/91)

tchrist@convex.COM (Tom Christiansen) writes:
| From the keyboard of ramsey@NPIRS.Purdue.EDU (Ed Ramsey):
| :Which shell, then?
| One that's sh compatible.  sh itself is pretty bare-bones, but still
| better csh by a parsec or three.  There's also the BRL shell, ksh, or 
| bash.

 There is also my personal favorite: ash, which can be found in volume
19 of your local comp.sources.unix archive site. Ash has shell
functions (with arguments done right), the usual builtin commands, a
simple but usefull form of command history, and it supports BSD job
control (you need to make a small change to get it to support job
control as a login shell). It's small, fast, and (IMHO) pretty damn
nice; I've been using it as my login shell for more than a year now
with no problems. If you want full command-line editing and suchlike,
there's a sepperate general front end called 'atty' (it's also
available in your local c.s.unix archives).

--
"That way, it won't matter so much which architecture "wins" (except
 to MIPS and Moto), which was most definitely NOT the case in the 68k
 vx. x86 conflict.  The 88k and the Rx000 both are CPUs that I can use
 without holding my nose."			- Alan Lovejoy
cks@hawkwind.utcs.toronto.edu	           ...!{utgpu,utzoo,watmath}!utgpu!cks