Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jul 2005 20:19:24 -0500
From:      Lane <lane@joeandlane.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: cat /dev/urandom
Message-ID:  <200507262019.25060.lane@joeandlane.com>
In-Reply-To: <ehhdehys9c.deh@mail.opusnet.com>
References:  <20050726183029.M97284@neptune.atopia.net> <d4b4435a0507261647325c336c@mail.gmail.com> <ehhdehys9c.deh@mail.opusnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 26 July 2005 20:03, you wrote:
> I don't use backticks, so this'll have the equivalent "$()".
>
> The command: cat /dev/urandom
> is passed to the shell and the shell executes "cat" and sends
> the output to the screen without possibility of executing anything
> (except the magic stuff recognized by your terminal emulator -- I hope
> it can't execute stuff).
>
> The command: $(cat /dev/random)
> is passed to the shell, where it does "command substitution" on
> it first and then executes it, where "it" is the output of the
> cat command, which could be destructive.
>
> Simpler tests are:
>
> pwd
> echo pwd
> $(echo pwd)
> echo $(echo pwd)
I think the backticks (and shell variables) actually send the output to a 
pipe, not the screen.

I use them in recursive shell scripts, on occasion, which are run by the cron 
daemon.  

Either technique can be a blessing ... or a curse, depending on how you use 
them.

lane



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