SHΛRK@lemmy.zip to Programmer Humor@programming.dev · 4 days agoLinux Catlemmy.zipexternal-linkmessage-square58linkfedilinkarrow-up11arrow-down10file-text
arrow-up11arrow-down1external-linkLinux Catlemmy.zipSHΛRK@lemmy.zip to Programmer Humor@programming.dev · 4 days agomessage-square58linkfedilinkfile-text
minus-squarelokalhorst@feddit.orglinkfedilinkarrow-up0·4 days agoIf it just want to look at the file, is there a better way then cat foo.txt? I guess I can’t just do < foo.txt
minus-squareTwilightKiddy@scribe.disroot.orglinkfedilinkEnglisharrow-up0·4 days agoYou can use less. There are also specialized ones for that purpose like bat.
minus-squaredan@upvote.aulinkfedilinkarrow-up0·4 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).
minus-squarenot_IO@lemmy.blahaj.zonelinkfedilinkEnglisharrow-up0·3 days agohow in the world is this not a useless use of echo and equivalent to <foo.txt
minus-squaredan@upvote.aulinkfedilinkarrow-up0·3 days agoOK, TIL you can just do <foo.txt. I didn’t think that worked. Thanks!
minus-squarenot_IO@lemmy.blahaj.zonelinkfedilinkEnglisharrow-up0·16 hours agoi don’t think you can but idk why that’s by I’m asking
minus-squaremote@lemmy.calinkfedilinkarrow-up0·4 days agoSo close! you have to do cat < foo.txt :-) (/s)
If it just want to look at the file, is there a better way then
cat foo.txt? I guess I can’t just do< foo.txtYou can use
less. There are also specialized ones for that purpose like bat.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:
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
So close! you have to do
cat < foo.txt:-) (/s)