Touch a file in Linuxprogramming.devimage chraebsli ( @chraebsli@programming.dev ) cake Programmer Humor@programming.dev • 4 months ago message-square45fedilinkarrow-up1665
arrow-up1665imageTouch a file in Linuxprogramming.dev chraebsli ( @chraebsli@programming.dev ) cake Programmer Humor@programming.dev • 4 months ago message-square45fedilink
minus-square 4am ( @4am@lemm.ee ) linkfedilink13•4 months ago“Do one thing and do it very well” is the UNIX philosophy after all; if you’re 99% likely to just create that missing file after you get a file not found error, why should touch waste your time?
minus-square Trailblazing Braille Taser ( @0x0@lemmy.dbzer0.com ) linkfedilink26•4 months agoBecause now touch does two things. Without touch, we could “just” use the shell to create files. : > foo.txt
minus-square deegeese ( @deegeese@sopuli.xyz ) linkfedilink15•4 months agoTouch does one thing from a “contract” perspective: Ensure the timestamp of is
minus-square dan ( @dan@upvote.au ) linkfedilink12•4 months agoSystemd also does one thing from a contract perspective: run your system
minus-square stebo ( @stebo02@lemmy.dbzer0.com ) linkfedilink13•4 months agowith this logic, any command that moves, copies or opens a file should just create a new file if it doesn’t exist and now you’re just creating new files without realising just because of a typo
minus-square Kusimulkku ( @Kusimulkku@lemm.ee ) linkfedilink7•4 months agoBut this directly goes against that philosophy, since now instead of changing timestamps it’s also creating files
“Do one thing and do it very well” is the UNIX philosophy after all; if you’re 99% likely to just create that missing file after you get a file not found error, why should
touch
waste your time?Because now touch does two things.
Without touch, we could “just” use the shell to create files.
Touch does one thing from a “contract” perspective:
Ensure the timestamp of is
Systemd also does one thing from a contract perspective: run your system
Oh no.
:(
Does it do it well, though?
with this logic, any command that moves, copies or opens a file should just create a new file if it doesn’t exist
and now you’re just creating new files without realising just because of a typo
But this directly goes against that philosophy, since now instead of changing timestamps it’s also creating files