Just a heads up, touch isn't actually meant to create files (although it does it if the specified string doesn't exist), it is meant to update a file's timestamp (in case you point it to an already existing file).
You could also add the < operator - which does the same as cat, but is actually meant to redirect stuff into the stdout of your terminal.
Just a heads up,
touchisn't actually meant to create files (although it does it if the specified string doesn't exist), it is meant to update a file's timestamp (in case you point it to an already existing file).You could also add the
<operator - which does the same ascat, but is actually meant to redirect stuff into the stdout of your terminal.Oh wow, I didn't know that about
touch. Thank you for clarifying this here.I tried the
<& that didn't seem to work on mac or linux.Weird, I've tried it in both systems and it works flawlessly.
Just to be sure, did you type in
< filetoread? A lack of example might've been the problem in my post.Try this:
or this (which means basically "write data to the file until you meet EOF label"):
>will rewrite contents of the file>>will append to the end of the file