9

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?

Gilles 'SO- stop being evil'
864k204 gold badges1.8k silver badges2.3k bronze badges
asked Oct 9, 2013 at 7:56

1 Answer 1

9

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.

peterph
31.5k3 gold badges74 silver badges76 bronze badges
answered Oct 9, 2013 at 8:05
2
  • 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. Commented Oct 9, 2013 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 Commented Oct 9, 2013 at 8:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.