Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
William
Ubuntu rm override/forcing a flag?
On Ubuntu with the Bourne again (BASH) shell I'm trying to force it to always use the -i flag with the rm command (so I can type "rm" but it will treat it as "rm -i" was typed.) The -i flag makes it so that you are promted before each removal of a file so I can cancel if I make a mistake. My problem is that I know this SHOULD be possible, but I'm not sure where I'm going wrong.
What I have done so far is changed my .profile file so it makes my $PATH have my /home/userprofile/bin folder as the first in the list. To specify, after logging in "echo $PATH" gives me
"/home/userprofile/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games".
Next, I created that bin folder and made a file named "rm". Inside the file I put:
#!/bin/sh
/bin/rm -i "$@"
which I believe will explicitly call rm with the -i flag and then all the arguments from the terminal parsed as seperate strings. After all that and ensuring it is executable, whenever I use rm it deletes multiple files without asking each time, but if I rename the file to anything else and call it, it does EXACTLY what I want it to. I believe the system is automatically jumping to the /bin in the root besides the fact I want it to search my bin folder first but I have no idea how to change this behaviour and I have had no luck searching around the internet. I know I could just use a different name, but the point is that I want anyone using the computer to have this benefit without having to call a different name because they may-as-well just put the -i flag in that case.
1 AnswerProgramming & Design8 years ago