linux - Getting bash to prompt the deletion of related dotfiles -


i find end in situation on ubuntu often, , wondering if there's neat way solve it.

suppose writing c++ programs, a.cpp, b.cpp , c.cpp. during testing, generate lot related files a.out, .a.out~, .a.un~ etc. if @ point later realise no longer need a.cpp, can perform rm a.cpp. left clutter of associated junk no longer relevant.

i aware can perform periodic rm .*.un~ i'm hoping better way. there way can rm prompt me @ point of deleting a.cpp

rm: remove regular file 'a.cpp'? y rm: remove associated file '.a.un~' too? 

which can 'y' or 'n' to?

this example makefile.

all:     g++ -o a.cpp  clean:     rm -f *~ 

make sure keep tabulators in front of g++ , rm.

compile make all , clean make clean.


Comments