News for hackers. Stuff that matters.
Re:Unix Shell Programming: The Next 50 Years [pdf] by pmoriarty on Friday June 04, 2021 @10:45AM (#27394115)
"Not to mention how dangerous it is to use. Accidentally type the > symbol? Enjoy overwriting whichever file came after in the command."

At least in zsh, you can prevent such mistakes by

  setopt NO_CLOBBER
It's saved my bacon many times.

Also, from bitter experience I've forced myself to get in to the habit of never typing:

  rm *
but instead always doing:

  cd ..
  rm foo/*
It forces me to be more conscious of what I'm deleting.
Re:Unix Shell Programming: The Next 50 Years [pdf] by bccdee on Friday June 04, 2021 @12:19PM (#27395192)
I have `alias rm="echo DISABLED"` in my shell rc, and I have `trash` defined as a big shell function that safely moves stuff to the x desktop trash bin without clobbering anything. It's mildly irritating, but it gives me incredible peace of mind.
Re:Unix Shell Programming: The Next 50 Years [pdf] by teddyh on Friday June 04, 2021 @11:15AM (#27394418)
> in zsh […] setopt NO_CLOBBER

In Bash it’s

  set -o noclobber
or

  set -C
Re:Unix Shell Programming: The Next 50 Years [pdf] by gnubison on Saturday June 05, 2021 @11:45PM (#27410611)
Those work in any POSIX shell, and also zsh.
Re:Unix Shell Programming: The Next 50 Years [pdf] by teddyh on Monday June 07, 2021 @07:54AM (#27421473)