22

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?

  • @Sirex short, but an answer. – jordanm Feb 10 '13 at 23:54
  • yeah, i guess ! – Sirex Feb 10 '13 at 23:55
41

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.

12

looks like a typo. .. ... .. ..

  • 1
    Thanks. Was wondering if I missing some glaringly simple linux concept here. =) – Mike B Feb 10 '13 at 23:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.