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?
1 Answer 1
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.
-
1I'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– Thomas Nyman2013年10月09日 08:29:07 +00:00Commented 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/BashGuideChris Down– Chris Down2013年10月09日 08:56:09 +00:00Commented Oct 9, 2013 at 8:56