Hi,
Can anyone please tell me what these lines do?
ls >& outfile
ls outfile 2>&1
Thanks.
Hi,
Can anyone please tell me what these lines do?
ls >& outfile
ls outfile 2>&1
Thanks.
ls >& outfile
output of ls command is redirected in a file named outfile
ls outfile 2>&1
if a file named outfile exists, then it is listed, and along with it, errors (represented by 2) are redirected to standard output (represented by 1), but that isn't useful in this case, you would have got any error on your terminal anyway.
if file outfile does not exist, then you will get message:
ls: newfile: No such file or directory