Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jul 1995 17:00:03 -0700
From:      "Bryan O'Sullivan" <bos@Eng.Sun.COM>
To:        Ade Barkah <mbarkah@hemi.com>
Cc:        hackers@freebsd.org
Subject:   Being curious with `cat * > file'
Message-ID:  <9507220000.AA19248@plokta.Eng.Sun.COM>
In-Reply-To: <199507192022.OAA10037@hemi.com>
References:  <199507192022.OAA10037@hemi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
a> What should `cat * > output` do ? Should it gracefully concatenate
a> all the files together into a file called `output', or will it
a> attempt to cat the output into itself so many times until the file
a> system is filled ?

Welcome to the happy world of Unix shell programming ("Semantics?
Uh... what that big word mean?").  Whether the filename expansion is
performed before or after the output-file-to-be is created depends on
the shell you are using and, interestingly enough, not a one of the
common shells whose manual pages I checked documented the order in
which such things happen.

The portable fix: don't try anything like "cat * > output".  It's not
a FreeBSD problem; it's universal.

	<b



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