everybody loves file·names which begin with U+002D HYPHEN-MINUS

@Lady Life hack: create a file named -i in your important directories so that if you `rm * ` while there you'll be prompted before anything gets erased.

@Lady I can't claim credit for this one. I saw it (or something similar, maybe a different flag or a different command) somewhere else, I don't remember where

... as legitimate, earnestly-suggested, advice.

@gaditb i feel like there is no guarantee that the -i file will appear first?? also who does `rm *` and not `rm -rf the_directory`

@gaditb lifehack: just start the name of any important file with a period so that rm * doesn’t glob it

@Lady Apparently

$ rm a b -i c
rm: remove regular empty file 'a'?

, I guess? Apparently it applies wherever in the command line it is.

Lifehack: use directories when organizing files like that. So like, `edit normal_file_that_can_be_rm_starred.txt` versus `mkdir -p .; edit ./important_file_safe_from_that.txt`

@gaditb rm a b -i c doesn’t work on FreeBSD rm; allowing options after filenames is a GNU-ism

Follow

@gaditb (FreeBSD rm being the ancestor of macOS rm, relevant in my case)

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.