Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Nov 2003 20:40:56 -0500
From:      Scott W <wegster@mindcore.net>
To:        Marty Landman <MLandman@face2interface.com>
Cc:        freebsd-questions@FreeBSD.org
Subject:   Re: a good way to save a keystroke?
Message-ID:  <3FBEBEA8.7000805@mindcore.net>
In-Reply-To: <6.0.0.22.0.20031121114154.08a0a190@pop.face2interface.com>
References:  <6.0.0.22.0.20031121114154.08a0a190@pop.face2interface.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Marty Landman wrote:

> I wanted to look at a file and figured why not pipe the output of 
> which to more, which of course didn't work so I figured if I 
> backticked the which output with more in front that would work, and 
> apparently it does (though I'm not sure that the cmd itself wasn't 
> executed?).
>
> e.g. more `which apachectl`
>
> Is this a reasonable way to get what I'm after, or a bad thing?


It's fine, although anything inside the ticks does in fact get executed, eg
which apachectl
expands to /usr/local/bin/apachectl (not running apache, don't remember 
the freebsd location offhand but you get the point)

so then the literal text '/usr/local/bin/apachectl' replaces the command 
inside the ticks to become:

more /usr/local/bin/apachectl

So yep, it's doing what you want, the way you wanted to...use something 
similar fairly often myself, although note that the 'current' standard 
for executing commands is now $(cmd), eg

more $(which apachectl)

Scott




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3FBEBEA8.7000805>