nested command substitution in csh

nested command substitution in csh

Post by Richard Bauma » Mon, 03 Jan 1994 10:58:42



Is it possible, in C-shell, to nest command substitution?  I'm looking for
a way to make instructions like the following work without having to capture
intermediate results into a shell variable:

    set DayOfWeek = ``date` | nawk '{split($0, arr); printf("%s", arr[1])}'`

Thanks in advance for any replies.

RLB

 
 
 

nested command substitution in csh

Post by Jozsef Ferin » Tue, 04 Jan 1994 03:19:03



>Is it possible, in C-shell, to nest command substitution?  I'm looking for
>a way to make instructions like the following work without having to capture
>intermediate results into a shell variable:

>    set DayOfWeek = ``date` | nawk '{split($0, arr); printf("%s", arr[1])}'`

Do you mean:

     set DayOfWeek = `date '+%a'`

Best regards, Jozsef

--

Freie Universitaet Berlin
Institut fuer Organische Chemie      Tel.: (+49 30) 838-2677, 838-5363
Takustr. 3, D-14195 Berlin, Germany  Fax : (+49 30) 838-5163, 838-4248

 
 
 

1. Newbie question: Nested command substitution???

How can I nest substituted commands? Here's what I need:

I have a directory e.g. /usr/velocity/spool/Queued/VBG-DWS-00001
What I need to extract is Queued.
Right now, I do something like this:

directory="/usr/velocity/spool/Queued/VBG-DWS-00001"
parent=`dirname $directory`
status=`basename $parent`

This works fine, but I would like to do something like this:

status=`basename `dirname $directory``

However, the above does not work, probably because the quoting is
screwed up. How do I do this right?

TIA

js


--
-------------------------------------------------------------
-     Experience is knowing things, you should not do.      -
-------------------------------------------------------------

2. Perl -- missing syscall.h

3. Can I nest command substitution

4. LPD listens to all interfaces

5. Nested command substitution?

6. Exchange server for linux

7. Multi-line command substitution (csh)

8. evolution/netscape and spam

9. csh command line substitution question

10. command line substitution in csh

11. Newlines inside command substitutions in csh

12. csh: escaping "{" and "}" in command substitution

13. csh syntax for embedded command substitution??