the > will delete any file that it points at even if the command doesn't
actually output anything. It will even delete the file is the command
doesn't exist like if you type grep as gerp >file, file will still be
created/overwritten.
If you want to make sure that your command doesn't overwrite any
existing files you have to set the noclobber option like:
$ set -o noclobber
A good trick to know:
You can use the > to delete the contents of a file without having to
delete and recreate the file by simply doing this:
$ >yourfile
Brian Cluff
On 08/24/2014 02:36 PM, Michael Havens wrote:
> I have a question about redirections:
>
> make>>make.fail 2>&1
>
> tells it make and then to send (>) stderr (2) to stdout (1) and also to
> send stdout that way also (&1). finally all of that gets sent to a file
> named make.fail (>>). Isn't '>>' actually 'append' whereas '>' would
> work just as well so long as the file didn't already exist? If the file
> did exist would I get an error or would the file be overwritten?
> :-)~MIKE~(-:
>
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss