chraebsli@programming.dev to Programmer Humor@programming.dev · 7 months agoTouch a file in Linuxprogramming.devimagemessage-square75fedilinkarrow-up11.15Karrow-down130
arrow-up11.12Karrow-down1imageTouch a file in Linuxprogramming.devchraebsli@programming.dev to Programmer Humor@programming.dev · 7 months agomessage-square75fedilink
minus-square48954246@lemmy.worldlinkfedilinkEnglisharrow-up21·edit-27 months agoFeels dangerous to run. What happens if the file already exists and has something important in it? touch -a is probably better
minus-squaregaterush@lemmy.worldlinkfedilinkarrow-up9·7 months agoThe other command could just be printf '' >> file to not overwrite it. Or even simpler >>file and then interrupt
minus-squareowsei@programming.devlinkfedilinkarrow-up10·7 months agoor :>>file then you don’t need to interrupt
minus-squaregaterush@lemmy.worldlinkfedilinkarrow-up3·7 months agothat’s awesome, did not know about that handy operator!
minus-squareowsei@programming.devlinkfedilinkarrow-up3·7 months agoYeah! it’s basically a noop, I use it as a placeholder when I’m writing a script, since bash doesn’t accept code blocks with no commands
Feels dangerous to run. What happens if the file already exists and has something important in it?
touch -a
is probably betterThe other command could just be
printf '' >> file
to not overwrite it. Or even simpler>>file
and then interruptor
:>>file
then you don’t need to interruptthat’s awesome, did not know about that handy operator!
Yeah!
it’s basically a noop, I use it as a placeholder when I’m writing a script, since bash doesn’t accept code blocks with no commands