Bash – Difference between >> and >\> operators

bashrhel

RHEL 6

Is there a difference between the >> and >\> operators? I read the following blurb in a RHEL training book:

"You can add standard output to the end of an existing file with a
double redirection arrow with a command such as ls >\> filelist

I'm more accustomed to the >> operator and when I try both, I get different results.

  • Using >> seems to append output to the file that follows it (as
    expected).
  • Using >\> seems to append output to a file literally called >

Is this a error in the book I'm reading? Or am I missing the author's point?

Best Answer

To append text to a file you use >>. To overwrite the data currently in that file, you use >. In general, in bash and other shells, you escape special characters using \.

So, when you use echo foo >\> what you are saying is "redirect to a file called >", but that is because you are escaping the second >. It is equivalent to using echo foo > \> which is the same as echo foo > '>'.

So, yes, as Sirex said, that is likely a typo in your book.

Related Question