The following example redirects the standard output into a file by using the > operator. By default, if the file already exists, then it will be overwritten. If you want to change the default behavior, you can use the command set -o noclobber (or set -C), which sets the noclobber option to prevent a file from being overwritten using redirection. You can cancel this option using set +o noclobber.
$ ls –l > lsoutput.txt
$set –C
$ls –l > lsoutput.txt
bash: lsoutput.txt: cannot overwrite existing file
$set +C
$ls –l > lsoutput.txt
The commands set -a or set -allexport will export all variables thereafter.