a good way to save a keystroke?

Scott W wegster at mindcore.net
Fri Nov 21 17:41:02 PST 2003


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




More information about the freebsd-questions mailing list