The redirection operation creates the new destination file. If the file already exists, it will be overwritten with the data in the standard output. You can set the noclobber feature to
prevent overwriting an existing file with the redirection operation. In this case, the redirection operation on an existing file will fail. You can overcome the noclobber feature by placing an
exclamation point after the redirection operator. You can place the noclobber command in a shell configuration file to make it an automatic default operation (see Chapter 11). The next
example sets the noclobber feature for the BASH shell and then forces the overwriting of the oldletter file if it already exists:
$ set -o noclobber
$ cat myletter >! oldletter
No comments:
Post a Comment