Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Should be easy but want to know why the “left arrow” < is used instead of right arrow.

   if
   fi
   done < a.txt

What does it mean by left arrow? I thought since I am done with the condition, the output should be saved in a.txt with right arrow like done > a.txt

Why we use left arrow for if-statement?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

arrows are for redirection: > redirects an output file-descriptor, < an input file-descriptor.

since you are asking a lot of questions that are all related, you really should have a look at the manpage of bash. Try:

man bash

it's available online and there' also a good documentation.

share|improve this answer
1  
I'd also recommend the Advanced Bash-Scripting Guide for learning bash. If you feel that it progresses too rapidly, the Bash Guide for Beginners might also be useful. –  Thomas Nyman Oct 9 '13 at 8:29
4  
@ThomasNyman The infamous "Advanced" Bash Scripting Guide should be avoided unless you know how to filter out the junk. It will teach you to write bugs, not scripts. In that light, the BashGuide was written: mywiki.wooledge.org/BashGuide –  Chris Down Oct 9 '13 at 8:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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