redirected to file2. Often the STDOUT file descriptor, (Shared web hosting)

redirected to file2. Often the STDOUT file descriptor, 1, is not written, so a shorter form of the basic syntax is command > file1 2> file2 You can also use the append operator in place of either standard redirect operator: command >> file1 2> file2 command > file1 2>> file2 command >> file1 2>> file2 The first form appends STDOUT to file1 and redirects STDERR to file2. The second form redirects STDOUT to file1 and appends STDERR to file2. The third form appends STDOUT to file1 and appends STDERR to file2. In the following example, I will illustrate using form1 because you are interested in only the output of the command: for FILE in $FILES do ln -s $FILE ./docs >> /tmp/ln.log 2> /dev/null done Here the STDOUT of ln is appended to the file /tmp/ln.log, and the STDERR is redirected to the file /dev/null, in order to discard it. Tip - The file /dev/null is a special file available on all UNIX systems used to discard output. It is sometimes referred to as the bit bucket . If you redirect the output of a command into /dev/null, it is discarded. You see it used for this purpose often. For example, the command rm file > /dev/null discards the output of the rm command. If you use cat to display the contents of /dev/null to a file, the file’s contents are erased: $ cat /dev/null > file After this command, the file still exists, but its size is zero. Redirecting STDOUT and STDERR to the Same File You looked at how to use file descriptors to redirect STDOUT and STDERR to different files, but sometimes you need to redirect both to the same file. In general, you do this by
Please visit our professional web hosting services to find out about cheap and reliable webhost service that will surely answer all your demands.

Leave a Reply