November 30, 2012

How do i use a function instead of a command?

e.x: i want to use "a" instead of "who" command but except using "alias" way :)

U can also try to use bash scripts / shell scripts for ur purpose. See here...

U can also try to use bash scripts / shell scripts for ur purpose. See here for more info: www.linfo.org/alias.html
AND
http://bash.cyberciti.biz/guide/Create_and_use_aliases

Like  (0 likes)

If I'm understanding your question correctly, you want to type in 'a' at the...

If I'm understanding your question correctly, you want to type in 'a' at the command prompt and get output of 'who' command.

Easiest way I know to do this is to add an alias statement to /home/[user]/.bashrc.

alias a=who

Here is partial excerpt of alias section of my .bashrc file:
alias nano='nano -w'
alias ls='ls -ahF --color=always'
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -I'

Also, 'man' command is your friend.
Try man alias
or man -k alias

hth
harv

Like  (0 likes)
Click Here!