Submitted by "lesley Yang" to comp.unix.shell:
Quote:> Hi,
> I have a book called "The new KornShell Command and Programming
> Language". In several chapters, it mentions "side effects" of
> built-ins. I'm confused what's that so that I can't understand some
> paragraphs. Any help is appreciated.
> Lesley Yang
The cd command changes the current directory. It changes the
value of $PWD and $OLDPWD as a side-effect.
Starting a new shell parses the file $ENV as a side-effect.
The creation of the file "/tmp/hello" is a side effect of the
following command (and so is the updating of the "last accessed"
timestamp on "/usr/bin/tee"):
STR=$(print "hello world" | tee /tmp/hello)
Some times, the "side-effect" is the main reason for executing a
command. The touch command, although not a ksh built-in, is
often used to update the timestamps on a file, but sometimes
it's used to create empty files.
Someone else may have a better explanation.
--
Andreas K?h?ri
--------------------------------------------------------------
Stable, secure, clean, free: www.netbsd.org