shark_byte@lemmy.zip to Programmer Humor@programming.dev · 2 days agoLinux Catlemmy.zipexternal-linkmessage-square58fedilinkarrow-up1405arrow-down18file-text
arrow-up1397arrow-down1external-linkLinux Catlemmy.zipshark_byte@lemmy.zip to Programmer Humor@programming.dev · 2 days agomessage-square58fedilinkfile-text
minus-squarelokalhorst@feddit.orglinkfedilinkarrow-up16·edit-22 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-squaredan@upvote.aulinkfedilinkarrow-up11·edit-21 day 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-up4·1 day agohow in the world is this not a useless use of echo and equivalent to <foo.txt
minus-squaredan@upvote.aulinkfedilinkarrow-up4·1 day agoOK, TIL you can just do <foo.txt. I didn’t think that worked. Thanks!
minus-squaremote@lemmy.calinkfedilinkarrow-up20·2 days agoSo close! you have to do cat < foo.txt :-) (/s)
minus-squareTwilightKiddy@scribe.disroot.orglinkfedilinkEnglisharrow-up3·1 day agoYou can use less. There are also specialized ones for that purpose like bat.
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.txtAdmittedly 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!So close! you have to do
cat < foo.txt:-) (/s)You can use
less. There are also specialized ones for that purpose like bat.