add prompt to rm command

classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

add prompt to rm command

e-letter
Readers,

How to add a verification prompt to the command 'rm', asking whether
the file is really to be deleted?

opensuse122
gnome
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

Roger Oberholtzer
On Thu, 2012-10-18 at 09:25 +0200, e-letter wrote:
> Readers,
>
> How to add a verification prompt to the command 'rm', asking whether
> the file is really to be deleted?
>
> opensuse122
> gnome

'man rm' tells

        -i     prompt before every removal


Yours sincerely,

Roger Oberholtzer

Ramböll RST / Systems

Office: Int +46 10-615 60 20
Mobile: Int +46 70-815 1696
[hidden email]
________________________________________

Ramböll Sverige AB
Krukmakargatan 21
P.O. Box 17009
SE-104 62 Stockholm, Sweden
www.rambollrst.se


--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

e-letter
In reply to this post by e-letter
Thanks, how to make that option permanent please?

Please reply directly and to mail list; a 'nomail' subscriber
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

Dave Howorth
e-letter wrote:
> Thanks, how to make that option permanent please?

Use a shell alias

> Please reply directly and to mail list; a 'nomail' subscriber

Please jpoin the list if you want to see my replies

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

David Haller-4
Hello,

On Thu, 18 Oct 2012, Dave Howorth wrote:
>e-letter wrote:
>> Thanks, how to make that option permanent please?
>
>Use a shell alias

*BLAM* *BLAM* *BLAM* *BLAM* *BLAM*

What a time tested way to shoot yourself in the foot.

As per Murphy, you'll "accidentally" remove the only existing copy of
your most important file WHEN (not if!) that alias is not set for
whatever reason, and at the most inconvenient time (e.g. your
dissertation the evening before your last chance to hand it in).

Really: DO NOT ALIAS 'rm' TO 'rm -i'. EVER.

THINK before you type and hit enter.

You may define a seperate name for the purpose, e.g. 'rmi', and you
won't do a 'rm' when you intend do to a 'rm -i'.

-dnh, never been using the "Winders" recycle bin ever, for the time I
    used Win (ca. '94/WfW3.11-'99/W95), and I never aliased rm. I
    manage my files with midnight-commander, and the GNU toolchest and
    some more (ls, cp, rm, mv, ..., mmv(!))

--
no amount of Zen contemplation will ever make you at one
with a 3c905B ethernet card.                 -- Alan Cox
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

Dave Howorth
David Haller wrote:
> Really: DO NOT ALIAS 'rm' TO 'rm -i'. EVER.
>
> THINK before you type and hit enter.

Good advice.
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

Anton Aylward-2
In reply to this post by David Haller-4
David Haller said the following on 10/18/2012 07:06 AM:

> As per Murphy, you'll "accidentally" remove the only existing copy of
> your most important file WHEN (not if!) that alias is not set for
> whatever reason,

As per the BASH man page, there is the ~/.bashrc personal initialization
file which is sourced for each interactive shell
that is started.

<quote>
When  an  interactive shell that is not a login shell is started, bash
reads and executes commands from ~/.bashrc, if that file exists.  This
may be inhibited by using the --norc option.  The --rcfile file option
will force  bash to read and execute commands from file instead of
~/.bashrc.

When  bash is started non-interactively, to run a shell script, for
example, it looks for the variable BASH_ENV in the environment, expands
its value if it appears there, and uses the expanded value as the name
of a file to  read and execute.  Bash behaves as if the following
command were executed:
              if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi

</quote

Nothing is idiot-proof (and there is a long line of ever more idiotic
idiots waiting to prove that) but therein is the OPs answer to "make it
permanent".  He can set BASH_ENV and the contents of ~/.bashrc to ensure
that the alias *IS* set whenever he has an interactive shell.

Perphas a shell function might be better than an alias :-)

> Really: DO NOT ALIAS 'rm' TO 'rm -i'. EVER.
>
> THINK before you type and hit enter.

I really don't like absolutes, except for a few physical constants.
Religious zealots may have their own set of absolutes they believe in,
but that isn't applicable here either.

Perhaps we should reconsider the use of the term 'permanent' as well :-)

--
I thought about being born again, but my mother refused.
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

David Haller-4
Hello,

On Thu, 18 Oct 2012, Anton Aylward wrote:
>David Haller said the following on 10/18/2012 07:06 AM:
>> Really: DO NOT ALIAS 'rm' TO 'rm -i'. EVER.
>>
>> THINK before you type and hit enter.
>
>I really don't like absolutes, except for a few physical constants.
>Religious zealots may have their own set of absolutes they believe in,
>but that isn't applicable here either.

To alias 'rm' is as aliasing gravity. You just don't. Or can't.

You may choose to ignore things, in private, at home. But don't tell!
I won't tell you about 'touch ./-i' either.

But: aliasing rm is just evil. You get used to use rm without
thinking, in the knowledge of having the safety net of '-i' at
work. Until you don't. And, as I've said, as per Murphy, that will
affect at the most inconvenient time the most important file.

In short: only use 'rm' as is. Think about it being aliased/scripted
or replaced by 'rm -f'.

If you don't want to use 'rm' in the way it was intended to (see
above), then just do not use it. Use a UI. Like mc or any of the GUIs
and their "filemanagers" ... The latter usually also have a "Feature"
called "Trash" (which they move the "deleted" files to, keep metadata
(AFAIK) and can restore them from using the metadata). Bah!

If you want to use 'rm -i', then do. Using 'rm -i'. Or create a
_SEPERATE_ alias like 'rmi' and use that.

There's also the case where you e.g. _really_ want to clean out a
folder (by pattern), and call e.g. 'rm 20101009*~'. Now. There's about
10k files matching the pattern '20101009*~'. Do you still want the
alias then? No? Why? EXCACTLY!

So, Anton, this is _not_ a case of "religion", this is _the_ case of
it not being such. A lot of stuff regarding the shell is up to
discussion, but this case is out. 'rm' has to be '/bin/rm'. And yes,
fuck anyone wanting to move that to /usr sideways with a chainsaw.

*GAH* /bin, /sbin and /lib[64] are there for a reason. I HATE initrds.
It's ok for distro's to use them, but forcing everyone to one FS or
using an initrd by moving stuff to /usr? Whatever they smoked, it's
been bad. Very bad. Mindblowingly bad (sic).

-dnh

--
The first time I had sex, I was terrified. I was alone..   -- Larry Cunningham
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

Carlos E. R.-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2012-10-18 16:13, David Haller wrote:
> But: aliasing rm is just evil. You get used to use rm without
> thinking, in the knowledge of having the safety net of '-i' at
> work. Until you don't. And, as I've said, as per Murphy, that will
> affect at the most inconvenient time the most important file.

I have to agree with this. I would use different wording though, like
"dangerous". :-)

- --
Cheers / Saludos,

                Carlos E. R.
                (from 12.1 x86_64 "Asparagus" at Telcontar)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlCAEN0ACgkQIvFNjefEBxrUHgCgl2fMxmlKGPx8GQ94G8HJczS8
6ooAn1YnJc1cLCHRA+oLXUSr8UsQ/IbO
=kq+A
-----END PGP SIGNATURE-----
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

Anton Aylward-2
In reply to this post by David Haller-4
David Haller said the following on 10/18/2012 10:13 AM:
> And, as I've said, as per Murphy, that will
> affect at the most inconvenient time the most important file.

Right.
And don't drink, you might choke, don't drive, you might crash; and so
on and so on and so on.

Its about risk management.
Like everything else in life.

There are no absolutes.


David, all you're doing is a knee-jerk, irrational rant.
Saying things that "It will happen, Murphy says so" are unhelpful.

What I tried saying in my previous post is that there are reasonable and
prudent measures that can be taken to mitigate the risk.  Nothing in
life is *absolutely* risk free.

Heck, maybe someone dropped a file named "-f" in one of your directories!

Now tell me, how likely is that?  Can you tell me - absolutely - that it
will happen?  Of course you can, along with those millions of monkeys
working on Shakespeare.  Given enough time ...

But what I'm trying to do is answer the OPs original question with a
"reasonable and prudent" set of measures to ensure that any interactive
shell *does* have the alias.  Of course he may go use another machine,
another account.  There are many possibilities.  But talking about
absolutes is unhelpful.

If the OP is willing to take those prudent measures and accept the risk,
that's is his decision.  You have made him aware there is a risk and
I've made him aware that there are reasonable and prudent measures he
can take to mitigate the risk.  From there on in its his responsibility:
not yours, not mine.

>
> In short: only use 'rm' as is. Think about it being aliased/scripted
> or replaced by 'rm -f'.

The trouble is that this kind of paranoia requires that you run the
'alias' comment before any other command to make sure that things like
'grep' have not been aliased to 'rm -f'.  Where does this stop?

>
> But: aliasing rm is just evil.

Think end of the wedge: there's a lot in the bash shell, the Korn shell
that you can label as such.  Oh, right, the command line is just too
powerful, too easy for people to make mistakes, that's why we have the
cotton-wool cradle of the GUI ..

> If you don't want to use 'rm' in the way it was intended to (see
> above), then just do not use it. Use a UI. Like mc or any of the GUIs
> and their "filemanagers" ... The latter usually also have a "Feature"
> called "Trash" (which they move the "deleted" files to, keep metadata
> (AFAIK) and can restore them from using the metadata). Bah!

<irony> You can ??? </irony>

And there's the idiot who wonders why his/her disk is full, so 'deletes'
a pile of files and _still_ the disk is full and blames the computer.

Incidentally: my attitude to RM is that I have the delete button on my
file manager really, really, really deleting the selected file or files.
Like that, I suppose, I'm in agreement with Humpty-Dumpty.
"When I use a word," Humpty Dumpty said in a rather a scornful tone,"it
means just what I choose it to mean --- neither more nor less."

And I *choose* the delete key to mean delete and I *choose* the command
line "rm" to mean "rm -i".

You can choose differently.
That's the beauty of Linux.
If I wanted to be handcuffed to someone else's idea of how things should
be done I'd use Windows (or possibly Gnome)




--
“When dealing with people, remember that you are not dealing with
creatures of logic, but creatures of emotions.” —Dale Carnegie
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

Anton Aylward-2
In reply to this post by Carlos E. R.-2
Carlos E. R. said the following on 10/18/2012 10:23 AM:
> I have to agree with this. I would use different wording though, like
> "dangerous". :-)

Lots of things are dangerous.
Even when using a computer.
But considering the potential and considering the way that are available
to handle this prudently and the controls available for risk management,
I don't see this rating very high on my risk-radar screen.

Enough with the bombast and absolutism.

--
If guns kill people then...
- Pencils mispell words.
- Cars make people drive drunk.
- Spoons make people overeat.
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

Carlos E. R.-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2012-10-18 16:52, Anton Aylward wrote:
> Carlos E. R. said the following on 10/18/2012 10:23 AM:
>> I have to agree with this. I would use different wording though,
>> like "dangerous". :-)
>
> Lots of things are dangerous.

We can not publicly advise dangerous Linux practices on a help list.


> Enough with the bombast and absolutism.

You can do whatever you choose, don't accuse me.

- --
Cheers / Saludos,

                Carlos E. R.
                (from 12.1 x86_64 "Asparagus" at Telcontar)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlCAGPsACgkQIvFNjefEBxpEWQCfYaMF1kdz+05EZME2+mvH1jlP
YeIAniXWT3tDbr1hMhoK90Xa5dqOI4FT
=YdpO
-----END PGP SIGNATURE-----
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

Anton Aylward-2
Carlos E. R. said the following on 10/18/2012 10:58 AM:
> On 2012-10-18 16:52, Anton Aylward wrote:
>> Carlos E. R. said the following on 10/18/2012 10:23 AM:
>>> I have to agree with this. I would use different wording though,
>>> like "dangerous". :-)
>
>> Lots of things are dangerous.
>
> We can not publicly advise dangerous Linux practices on a help list.

Yes we can and yes we do!
Look back: we've advised people about editing the partition table -
that's high risk of zapping your system, certainly more prone to
disastrous consequences of a type than a user type on a 'rm' command.

But then we also advise prudent and reasonable measure to manage the
risk such as making backups first.

What we *don't* do is tell people who need to edit their partition
table, grow their file system, is not to do that because they can shoot
themselves in their foot if they get it wrong.

Like I keep saying, there is always a risk in just about every aspect of
life.  We take reasonable and prudent measures to mitigate the risk and
get on with things.  We do not spend out lives avoiding risk.

We can't simply go around telling people "you can't do that because its
dangerous". Nothing would ever get done.  Yes, dangerous things have to
be undertaken, and we should understand the risk *AND* we should take
prudent and responsible measures to mitigate the risk.


--
Life's a bitch.   Then you die.
Then you get re-incarnated and it starts all over again only worse.
And it doesn't matter if you don't believe in reincarnation,
Life's still a bitch.
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command (just change POSIX!)

L A Walsh
In reply to this post by David Haller-4
David Haller wrote:
> If you don't want to use 'rm' in the way it was intended to (see
> above), then just do not use it.
----
No No No...

You just go change POSIX... ... That's what some people did.

You used to be able to delete all files in a directory (AND NOT the directory)
VERY safely by using
cd "dir" && rm -fr .

---
You also  used to be able to shut off all messages (ignoring errors with
permissions, etc), using "-f".

But both of those have been changed .

In fact, there is no way to get rm to remove all files
in a directory and not also remove the directory without using
some 'helper' (like shell or find).  I.e. "rm *" relies
on the shell to expand things, BUT posix changed things there
recently as well.

"echo *" used to not show hidden files.  Now it does, by default
(unless you toggle an option in bash to undo it).


If you want to safely delete all files under a dir on the same
file system?   I.e. like "rm -fr --onefilesystem .", don't think
that "rm -fr --onefilesystem *"  will due the same thing.  It won't.


Of course you can still use "cp -a foo ." and end up with dir 'foo' in
dot, vs. "cp -a foo/. ." to get all contents of foo in ".", but you
cannot use rm -fr foo/.

Of course "rm -r foo" may delete "foo"  but not it's contents, if
foo was a symlink (just like ls foo => gives foo@") or even
"ls foo/" => "foo/@" if the '/' was given when creating the symlink.

But you _could_ get the contents using "foo/." -- but not as of
about 2 years ago when POSIX 2008's changes came into force in 2010
release of SUSE10.2 or .1 (wasn't in 10).


So if you don't like the way things work and think it is not safe
enough -- you can just get the command changed and make unix more
like Windows...


;-(

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command (just change POSIX!)

Philipp Thomas-3
On Fri, 19 Oct 2012 08:30:44 -0700, Linda Walsh <[hidden email]>
wrote:

>You just go change POSIX... ... That's what some people did.

Take your personal vendetta to the offtopic mailing list or somewhere
else where it's appropriate. Here it isn't.

Philipp
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

Cristian Rodríguez-2
In reply to this post by e-letter
El 18/10/12 04:25, e-letter escribió:
> Readers,
>
> How to add a verification prompt to the command 'rm', asking whether
> the file is really to be deleted?


That happends when you use the wrong shell, do not do that ! :-)

use something proper like ZSH.

$ rm *
zsh: sure you want to delete all the files in ./logs [yn]?


--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command (just change POSIX!)

L A Walsh
In reply to this post by Philipp Thomas-3
Philipp Thomas wrote:
> On Fri, 19 Oct 2012 08:30:44 -0700, Linda Walsh <[hidden email]>
> wrote:
>
>> You just go change POSIX... ... That's what some people did.
>
> Take your personal vendetta to the offtopic mailing list or somewhere
> else where it's appropriate. Here it isn't.
>
> Philipp
----
I wouldn't have responded but you actually sent two different emails about
this?



And how was my email any more or less off topic than those who were
responding about how to use rm?  I'm talking about how rm is
architected, and how it is designed down to the lowest common denominator
and how the new POSIX is a violation of the the older POSIX rules and compliance.

As for putting aliases to commands -- I go one better.  I alter the
binaries on my system to behave how I wish.

Bet you love that one.


--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

Joe(theWordy)Philbrook
In reply to this post by Cristian Rodríguez-2

It would appear that on Oct 22, Cristian Rodríguez did say:

> El 18/10/12 04:25, e-letter escribió:
> > Readers,
> >
> > How to add a verification prompt to the command 'rm', asking whether
> > the file is really to be deleted?
>
>
> That happends when you use the wrong shell, do not do that ! :-)
>
> use something proper like ZSH.
>
> $ rm *
> zsh: sure you want to delete all the files in ./logs [yn]?
What the {expletive deleted} does the OP's choice in shells got to do with it??

That is a function of the rm command itself...
I can't say for sure about ALL shells, but in bash, the way to get rm
to run in interactive mode by default is to use the alias command.
Here is an example of how to do that in a temporary way:

Note: first I'll use the bash command to open a child shell so that I can
ditch interactive mode just by exiting back to the parent shell...

JtWdyP -> ~/tmp
> bash
JtWdyP -> ~/tmp
> alias rm="rm -i"
JtWdyP -> ~/tmp
> ls tst
tst
JtWdyP -> ~/tmp
> rm tst
rm: remove regular file ‘tst’? n
JtWdyP -> ~/tmp
> exit
JtWdyP -> ~/tmp
> rm tst
JtWdyP -> ~/tmp
> ls tst
ls: cannot access tst: No such file or directory
JtWdyP -> ~/tmp
>

If I actually liked that durned interactive prompt getting in my way, I'd put
the ' alias rm="rm -i" ' command in my ~/.bashrc. Then every time I opened a
new bash shell it would automatically have the "rm" command aliased to "rm -i"

As far as I know, that method works with most shells except that the name of
the rc file would vary... In your case Cristian, I'd expect you would find
something similar in your ~/.zshrc if you looked for it...

--
|   ---   ___
|   <0>   <->    
|       ^              JtWdyP
|    ~\___/~      

<< there's nothing like an idiot who thinks he knows everything, of >>
<< course, if I actually knew everything, I'd know I was an idiot.  >>
Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

Brian K. White
In reply to this post by Anton Aylward-2
On 10/18/2012 8:18 AM, Anton Aylward wrote:

> David Haller said the following on 10/18/2012 07:06 AM:
>
>> As per Murphy, you'll "accidentally" remove the only existing copy of
>> your most important file WHEN (not if!) that alias is not set for
>> whatever reason,
>
> As per the BASH man page, there is the ~/.bashrc personal initialization
> file which is sourced for each interactive shell
> that is started.
>
> <quote>
> When  an  interactive shell that is not a login shell is started, bash
> reads and executes commands from ~/.bashrc, if that file exists.  This
> may be inhibited by using the --norc option.  The --rcfile file option
> will force  bash to read and execute commands from file instead of
> ~/.bashrc.
>
> When  bash is started non-interactively, to run a shell script, for
> example, it looks for the variable BASH_ENV in the environment, expands
> its value if it appears there, and uses the expanded value as the name
> of a file to  read and execute.  Bash behaves as if the following
> command were executed:
>                if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
>
> </quote
>
> Nothing is idiot-proof (and there is a long line of ever more idiotic
> idiots waiting to prove that) but therein is the OPs answer to "make it
> permanent".  He can set BASH_ENV and the contents of ~/.bashrc to ensure
> that the alias *IS* set whenever he has an interactive shell.
>
> Perphas a shell function might be better than an alias :-)
>
>> Really: DO NOT ALIAS 'rm' TO 'rm -i'. EVER.
>>
>> THINK before you type and hit enter.
>
> I really don't like absolutes, except for a few physical constants.
> Religious zealots may have their own set of absolutes they believe in,
> but that isn't applicable here either.
>
> Perhaps we should reconsider the use of the term 'permanent' as well :-)
>

When he is on any other machine but his own, or his own after an update,
or his own when under some other user account, or his own when in some
other shell, or his own when writing a non-interactive script that may
also not run under his user environment (cgi, cron, init, etc), "rm"
will behave like "rm" and no like he had trained himself to think that
rm behaves.

Antons advice is 100% correct and it's irresponsible to help users do
things wrong.

--
bkw



--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: add prompt to rm command

Brian K. White
On 11/4/2012 9:38 PM, Brian K. White wrote:

> On 10/18/2012 8:18 AM, Anton Aylward wrote:
>> David Haller said the following on 10/18/2012 07:06 AM:
>>
>>> As per Murphy, you'll "accidentally" remove the only existing copy of
>>> your most important file WHEN (not if!) that alias is not set for
>>> whatever reason,
>>
>> As per the BASH man page, there is the ~/.bashrc personal initialization
>> file which is sourced for each interactive shell
>> that is started.
>>
>> <quote>
>> When  an  interactive shell that is not a login shell is started, bash
>> reads and executes commands from ~/.bashrc, if that file exists.  This
>> may be inhibited by using the --norc option.  The --rcfile file option
>> will force  bash to read and execute commands from file instead of
>> ~/.bashrc.
>>
>> When  bash is started non-interactively, to run a shell script, for
>> example, it looks for the variable BASH_ENV in the environment, expands
>> its value if it appears there, and uses the expanded value as the name
>> of a file to  read and execute.  Bash behaves as if the following
>> command were executed:
>>                if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
>>
>> </quote
>>
>> Nothing is idiot-proof (and there is a long line of ever more idiotic
>> idiots waiting to prove that) but therein is the OPs answer to "make it
>> permanent".  He can set BASH_ENV and the contents of ~/.bashrc to ensure
>> that the alias *IS* set whenever he has an interactive shell.
>>
>> Perphas a shell function might be better than an alias :-)
>>
>>> Really: DO NOT ALIAS 'rm' TO 'rm -i'. EVER.
>>>
>>> THINK before you type and hit enter.
>>
>> I really don't like absolutes, except for a few physical constants.
>> Religious zealots may have their own set of absolutes they believe in,
>> but that isn't applicable here either.
>>
>> Perhaps we should reconsider the use of the term 'permanent' as well :-)
>>
>
> When he is on any other machine but his own, or his own after an update,
> or his own when under some other user account, or his own when in some
> other shell, or his own when writing a non-interactive script that may
> also not run under his user environment (cgi, cron, init, etc), "rm"
> will behave like "rm" and no like he had trained himself to think that
> rm behaves.
>
> Antons advice is 100% correct and it's irresponsible to help users do
> things wrong.
>

Davids advice!

--
bkw
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

12