Alias's & Functions - simple question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Alias's & Functions - simple question
# 1  
Old 10-31-2002
Alias's & Functions - simple question

Having a memory lapse:

If I redefine a command using an alias or a function - How do I access the "real" command without specifying an absoulte path:

i.e.

function man
{
/usr/bin/man |more
}

alias ls='/usr/bin/ls -l'

How do I specify the ls or man command above without the absolute path. Or - at the command line I want to invoke the command for ls or man & not invoke the alias or function

Thanks!
# 2  
Old 10-31-2002
unalias is what you are looking for.

From the manpage

unalias name ...
unalias -a

Remove each name from the alias list. With -a, remove all alias definitions from the current shell execution environment.

Smilie
# 3  
Old 10-31-2002
Sorry - unalias, unset -f are not what I'm looking for -
Am looking to invoke the original command and not invoke the alias or function as a "one shot"
# 4  
Old 10-31-2002
Use full path.

Well, then you should use the full path instead of the short command that you aliased as: alias ls='ls -l'


/usr/bin/ls somefile

instead of:

ls somefile


I am not sure there is another way... besides this one.

Smilie
# 5  
Old 10-31-2002
Many shells will let you prefix it with a backslash:
\ls
\man
# 6  
Old 10-31-2002
Quoting all or part of an alias will stop it from being recognized as an alias. You can use an alias to override a function. The latest version of ksh has the "command" command which will execute a command ignoring functions. But the "command" command will demote a special built-in to an ordinary built-in. So that won't work well if you named a function "typeset" or something.
# 7  
Old 11-01-2002
Thanks all.

Using a backslash \ls or quoting "ls", 'ls' works to access the "real" command as opposed to the alias.

This method does not seem to work for functions.

I'm running an older version of ksh
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Simple .sh and alias or ? whatever. Do backup!

Hi , Using bash shell (mintty) in cygwin/windows env. for some time and having issues with most basic commands. Will be quite easy to get er done once I know how , just like magic tricks. I need either alias OR shell script to change windows to posix path AND put that line back -input OR .cd to... (2 Replies)
Discussion started by: sircuts
2 Replies

2. Solaris

Simple question: alias not working for root

OS = Solaris 8 Issue: alias not working for root, but working for regular users # grep root /etc/passwd root:x:0:1:Super-User:/:/sbin/sh # alias dir=ls # dir dir: not found # alias dir="ls -l" # dir dir: not found # alias dir='ls -l' # dir dir: not found # alias... (2 Replies)
Discussion started by: aixlover
2 Replies

3. Shell Programming and Scripting

alias a simple ls -l command

how do I alias the following command: ls -l |egrep 'drw|dr-|d--|d-w' The alias command needs single quotes and so does the above command, so this does not work: alias LSDIR 'ls -l |egrep 'drw|dr-|d--|d-w' ' My problem is how do I get a listing of only directories? Solaris 8 SUN Ultra 10... (4 Replies)
Discussion started by: ajp7701
4 Replies

4. UNIX for Dummies Questions & Answers

here's how i did a very simple install of invidia drivers

ok i got the nvida drivers for mandrake9 rpm there is 3 rpms you must have glx ,kernel and something else email me if you want the precompiled drivers :: email removed :: once i got the drivers in stalled then i reseted the computer then i put the 1cd of mandrake9 in and did a upgrade i... (2 Replies)
Discussion started by: amicrawler2000
2 Replies

5. UNIX for Dummies Questions & Answers

Further question on 'ifconfig' output

I asked a similar question earlier and got a very good answer but a new doubt came up. This is a few lines of a '/sbin/ifconfig' command on my PC: RX packets:3781025 errors:0 dropped:0 overruns:0 frame:0 TX packets:1941909 errors:0 dropped:0 overruns:0 carrier:0 Does the RX and TX packets... (1 Reply)
Discussion started by: mint1981
1 Replies

6. UNIX for Dummies Questions & Answers

changing directories (i'm sure there is a simple solution for this)

I just want to exit my script in a new directory from a bash shell. Problem is that the script internally changes to the directory I want to move to, however when exits is still in the original directory. Does that make sense? ie usage: goto null changing from /usr/bin/xtra/test/test3/ ... (8 Replies)
Discussion started by: Shakey21
8 Replies

7. UNIX for Dummies Questions & Answers

What is with the '&'.

Hi Gurus, I would appreciate if someone could enlighten this newbie as to how significant the '&' is to unix. Currently I am getting around to writing a script which has to deal with a lot of these ampersands either as starting chars or between chars. Please find below the simpliest way that I... (4 Replies)
Discussion started by: buRst
4 Replies

8. Shell Programming and Scripting

Clearify what it means under 'WHAT' when hit the 'w'-command

I wonder how I shall read the result below, especially 'what' shown below. The result was shown when I entered 'w'. E.g what is TOP? What is gosh ( what does selmgr mean?)? login@ idle JCPU PCPU what 6:15am 7:04 39 39 TOP 6:34am 6:45 45 45 TOP 6:41am ... (1 Reply)
Discussion started by: Aelgen
1 Replies

9. UNIX for Dummies Questions & Answers

'find' command question

my solaris text talks about the 'find' command... it further goes to talk about an "action" used with the find command. I am completely confused as to what the {} do with the find comand. the explanation is this: "A set of braces, {}, delimits where the file name is passed to the command from... (2 Replies)
Discussion started by: xyyz
2 Replies

10. Programming

a very simple question (but i don't know)

how to write a program that receive a string from keyboard and then print it out. i write a program: main() { char str; gets(str); printf(str); } but when i compile it, the system said something like "new line is not last charicter" and sometime the system said "a3.c is up to date"... (1 Reply)
Discussion started by: dell9
1 Replies
Login or Register to Ask a Question