I have work multiple directory location and sometime delete directory which should not be deleted.
Is it possible to run pwd command before execute any command. and if I remove any file should I have warning or any message info
I have work multiple directory location and sometime delete directory which should not be deleted.
Is it possible to run pwd command before execute any command. and if I remove any file should I have warning or any message info
To receive warning use -i
option of rm
:
$ rm -i test.file
Instead of running pwd
before any command just put current directory path into your prompt. Add \w
to $PS1
wariable. For example set it like this:
PS1="[\w]\$ "
Another solution, is to create an alias like this:
alias rm="pwd; /bin/rm -rfi"
With '-i' option you have to confirm the removing.
If you want that alias is loaded on startup you can add on the bottom of file:
~/.bashrc