I do not understand this at all:
Question: Redirect the contents of gymnastics.txt as standard input for the
Answer: cat < gymnastics.txt
I understand the >> and the > operators. But, I am at a loss for the < and the << operators. Does this mean that the contents of gymnastics.txt will go into cat? What happens when we use cat again?
There is no << as i know. < works like a function. It makes gymnastics.txt to use itself as cat gymnastics.txt.
so if you type: “cat < gymnastics.txt” (then press enter) then you type: gymnastics.txt it will output the gymnastics file. But then again I’m no such a bash wizard
I figured I’d go through the Command Line training and see if I could learn anything knew. I use bash on a daily basis so I’m no novice. I’ve never heard of anyone using “cat < lakes.txt”. When I saw that I was confused. “cat lakes.txt” and “cat < lakes.txt” give the same output. I’m guessing it’s in there for some reason that I may run into later. But as far as I know the “<” is completely extraneous and not necessary.
You should be fine not using it. “cat lakes.txt” works just fine.
If I have some epiphany later I’ll edit my post.
I came to the forum to ask about the ‘<’ as well. Could not see how it was different than just using whatever command you want on the file or directory. Thank you for confirming that it is (at least it seems) extraneous in most cases.