SHΛRK@lemmy.zip to Programmer Humor@programming.dev · 2 months agoLinux Catlemmy.zipexternal-linkmessage-square69linkfedilinkarrow-up1439arrow-down19file-text
arrow-up1430arrow-down1external-linkLinux Catlemmy.zipSHΛRK@lemmy.zip to Programmer Humor@programming.dev · 2 months agomessage-square69linkfedilinkfile-text
minus-squarelokalhorst@feddit.orglinkfedilinkarrow-up18·edit-22 months 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-up22·2 months agoSo close! you have to do cat < foo.txt :-) (/s)
minus-squaredan@upvote.aulinkfedilinkarrow-up13·edit-22 months 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-up6·2 months agohow in the world is this not a useless use of echo and equivalent to <foo.txt
minus-squaredan@upvote.aulinkfedilinkarrow-up6·2 months agoOK, TIL you can just do <foo.txt. I didn’t think that worked. Thanks!
minus-squarenot_IO@lemmy.blahaj.zonelinkfedilinkEnglisharrow-up2·2 months agoi don’t think you can but idk why that’s by I’m asking
minus-squareTwilightKiddy@scribe.disroot.orglinkfedilinkEnglisharrow-up4·2 months agoYou can use less. There are also specialized ones for that purpose like bat.
minus-squareMonkeMischief@lemmy.todaylinkfedilinkarrow-up1·2 months agoIf it’s really long, I use less , because it breaks it up into navigable pages instead of filling your entire buffer. :) Never knew about just using < though! Cool!
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
You can use
less. There are also specialized ones for that purpose like bat.If it’s really long, I use
less, because it breaks it up into navigable pages instead of filling your entire buffer. :)Never knew about just using < though! Cool!