🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #62

Re: shell problems

#62
From: Dave Hopkins
Date: Wed, 04 Nov 1992 00:31
24 lines
1017 bytes
wongm@ipc5.lat.oz.au (M.C. Wong) writes:


>  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

This is possible if each nested backquote is quoted in a _nested_ manner.

Example (in Bourne Sys V Shell):

  echo `echo \`echo \\\`echo \\\\\\\`pwd\\\\\\\` \\\` \` `

Although trivial, the above does work.  What puzzles me is that the number
of required backslashes follows this pattern:  1 3 7 11 15 ...

Hope this helps,

Dave Hopkins
dwhopkin@vela.acs.oakland.edu
Technical Details
Message-ID: <dwhopkin.720837062@vela>
Path: arc1-ca.pugleaf.net!sparky!uunet!destroyer!wsu-cs!vela!vela!dwhopkin
References: <1992Oct31.115106.552@latcs1.lat.oz.au>

Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.shell
Path: arc1-ca.pugleaf.net!sparky!uunet!destroyer!wsu-cs!vela!vela!dwhopkin
From: dwhopkin@vela.acs.oakland.edu (Dave Hopkins)
Subject: Re: shell problems
Message-ID: <dwhopkin.720837062@vela>
Organization: Oakland University, Rochester MI.
References: <1992Oct31.115106.552@latcs1.lat.oz.au>
Date: Wed, 4 Nov 1992 00:31:02 GMT
Lines: 24