🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #33

shell problems

#33
From: M.C. Wong
Date: Sat, 31 Oct 1992 11:51
52 lines
1862 bytes
Hi,
  I have a few questions about using the shells (csh, tcsh and sh).

  1) In csh/tcsh we can do quick substitution of commands, eg :

     1 > echo a a a a 
     a a a a
     2 > ^a^b
     b a a a
     3 > !:s/a/b/g&
     b b b b
     . 
     .
     .
      
     My question is, if I am going to some substitution on only say
     the 1st, 3rd argument on the last comand, is there any quick 
     way doing that, without saying things like :

     echo `subs !:1` !:2 `subs !:3` `subs!:4`,

     assuming that subs is a shell alias that we do some transforming
     of its argument.

     Is there any quick way that we can use to substitue the arguments
     in random order, instead of global (altough it's powerful) ?

  2) How can I achieve nested command substitution , eg :

     cmd1 `cmd2 `cmd3 `cmd4 `...` ` ` ` ?

     I do not want to use pipe to achieve that, ie I don't want to say :

     cmdN | ... | cmd4 | cmd3 | cmd2 | cmd1

  3) How can I make an alias that reads from stdin ? I have got a small
     alias :

     alias upcase 'echo \!* | tr "[a-z]" "[A-Z]"' that converts its argument
     to upper case. Hoever it will not work properly when I pipe the output
     of another command to it , ie :

     prog | upcase , doesn't work! 

     Also, I don't want to do : upcase `prog` .


  Email replies are welcomed!!


  - wongm@latcs1.lat.oz.au
Technical Details
Message-ID: <1992Oct31.115106.552@latcs1.lat.oz.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!ariel.ucs.unimelb.EDU.AU!ucsvc.ucs.unimelb.edu.au!lugb!latcs1!ipc5.lat.oz.au!wongm

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!ariel.ucs.unimelb.EDU.AU!ucsvc.ucs.unimelb.edu.au!lugb!latcs1!ipc5.lat.oz.au!wongm
Newsgroups: comp.unix.shell
Subject: shell problems
Message-ID: <1992Oct31.115106.552@latcs1.lat.oz.au>
From: wongm@ipc5.lat.oz.au (M.C. Wong)
Date: Sat, 31 Oct 1992 11:51:06 GMT
Sender: news@latcs1.lat.oz.au (news)
Organization: Comp Sci, La Trobe Uni, Australia
Nntp-Posting-Host: ipc5.lat.oz.au
Lines: 52