Multiple domain web hosting - command > file 2>&1 list > file 2>&1

command > file 2>&1 list > file 2>&1 Here STDOUT (file description 1) and STDERR (file descriptor 2) are redirected into the specified file. Here is a situation where it is necessary to redirect both the standard output and the standard error: rm -rf /tmp/my_tmp_dir > /dev/null 2>&1 ; mkdir /tmp/my_tmp_dir Here, you are not interested in the error message or the informational message printed by the rm command. You only want to remove the directory, thus its output or any error message it prints are redirected to /dev/null. If you had one command that should append its standard error and standard output to a file, you use the following form: command >> file 2>&1 list >> file 2>&1 An example of a command that might require this is rdate -s ntp.nasa.gov >> /var/log/rdate.log 2>&1 Here you are using the rdate command to synchronize the time of the local machine to an Internet time server and you want to keep a log of all the messages. Printing a Message to STDOUT You can also use this form of output redirection to output error messages on STDERR. The basic syntax is echo string 1>&2 printf format args 1>&2 You might also see these commands with the STDOUT file descriptor, 1, omitted: echo string >&2 printf format args >&2 As an example, say that you need to display an error message if a directory is given instead of a file. You can use the following if statement: if [ ! -f $FILE ] ; then echo “ERROR: $FILE is not a file” >&2 ; fi Redirecting Two File Descriptors You can redirect STDOUT and STDERR to a single file by using the general form for redirecting the output of one file descriptor to another:
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

Leave a Reply