SHΛRK@lemmy.zip to Programmer Humor@programming.dev · 5 days agoLinux Catlemmy.zipexternal-linkmessage-square45linkfedilinkarrow-up116arrow-down10file-text
arrow-up116arrow-down1external-linkLinux Catlemmy.zipSHΛRK@lemmy.zip to Programmer Humor@programming.dev · 5 days agomessage-square45linkfedilinkfile-text
minus-squarelokalhorst@feddit.orglinkfedilinkarrow-up1·edit-25 days agoIf I just want to look at the file, is there a better way than cat foo.txt? I guess I can’t just do < foo.txt
minus-squaremote@lemmy.calinkfedilinkarrow-up1·5 days agoSo close! you have to do cat < foo.txt :-) (/s)
minus-squaredan@upvote.aulinkfedilinkarrow-up0·edit-24 days agoAdmittedly I still use cat for this. This also works too, but it’s more verbose: echo "$(<foo.txt)" It’s mentioned in the Bash man pages: The command substitution $(cat file) can be replaced by the equivalent but faster $(< file). EDIT: I was just informed that simply <foo.txt works too.
minus-squarenot_IO@lemmy.blahaj.zonelinkfedilinkEnglisharrow-up2·5 days agohow in the world is this not a useless use of echo and equivalent to <foo.txt
minus-squaredan@upvote.aulinkfedilinkarrow-up1·4 days agoOK, TIL you can just do <foo.txt. I didn’t think that worked. Thanks!
minus-squarenot_IO@lemmy.blahaj.zonelinkfedilinkEnglisharrow-up2·2 days agoi don’t think you can but idk why that’s by I’m asking
If I just want to look at the file, is there a better way than
cat foo.txt? I guess I can’t just do< foo.txtSo close! you have to do
cat < foo.txt:-) (/s)Admittedly I still use
catfor this.This also works too, but it’s more verbose:
echo "$(<foo.txt)"It’s mentioned in the Bash man pages:
EDIT: I was just informed that simply
<foo.txtworks too.how in the world is this not a useless use of echo and equivalent to
<foo.txtOK, TIL you can just do
<foo.txt. I didn’t think that worked. Thanks!i don’t think you can but idk why that’s by I’m asking