How to undo alias, PATH=$PATH:./Test - (Unix)

4

1.) In a terminal when we make an alias for any command line,the life of that alias is as long as the terminal is open.

alias new_command=old_command

example: alias dog=cat

But can we explicitly undo the alias command? i.e undo the alias assigned to that command without closing the terminal.

2.) Also when we do something like PATH=$PATH:.:/Test

We add the files to that directory wherein all the command are stored.How do we undo this? One way of doing it is by closing the terminal,whats the other way?

I'm new to Unix ,please help. Correct me if i'm wrong

Pavitar

Posted 2010-10-14T19:42:46.263

Reputation: 451

For general $PATH manipulations see my Stack Overflow question How do I manipulate $PATH elements in shell scripts?.

– dmckee --- ex-moderator kitten – 2010-10-14T23:32:21.630

Answers

9

1) unalias dog

2) This will remove the lastmost directory from your path: PATH=${PATH%:*}. Repeat it as needed for however many bad entries you've got.

Daenyth

Posted 2010-10-14T19:42:46.263

Reputation: 5 742

Carefully with %. :) – Casual Coder – 2010-10-14T20:00:51.743

0

1) You mean like unalias ?

Casual Coder

Posted 2010-10-14T19:42:46.263

Reputation: 3 614