I'm fairly new to bash/linux and was trying to do the following:
echo < test.txt
where test.txt just contains a bunch of text. The problem is this just prints a blank line to the terminal output.
I understand I could just use cat
but I'm trying to understand why redirecting input to echo
isn't working.
echo < test.txt
Will not work because echo
operates on a format string, not redirected file input (i.e. stdin
). What you want is cat
cat test.txt
cat
short for concatenate will cat
test.txt to stdout
. note: its companion tac
will write test.txt
to stdout
in reverse.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With