PDA

View Full Version : [HowTo]Creating a Alias for adom (linux)



theotherhiveking
03-11-2008, 04:20 PM
I bet there are some linux users that dont know what a alias is, or they just dont care much about the terminal except for playing adom, or other roguelikes.

The usual way to launch adom is to opeth the shell and type the full path, this is not nice.

Its much nicer to just type "adom" and launch it without messing with everything, specially if you don't have root rights.

1a. Open the terminal and type this:

alias adom="/path/to/adom/adom"Where /path/to/adom is the folder where the binary is stored.

If you did like me and you just uncompressed it in your home folder, this will do

1b.


alias adom="~/adom/adom"
The first word after alias is the word we are going to use to launch the game.

So alias cow="/path/to/adom/adom" will start adom everytime we type "cow".


Of couse this is not permanent, and will be gone after we close the session.

2a. Making it permanent.
Chose you favourite text editor, (i'm using nano)
Open the following file :

nano -w .bashrcIf the file it opens its empty try this:


sudo nano -w /etc/bash.bashrc
Now scroll down until the end of the file (pag down key)
Write the alias definition that worked for you at the end.You should get something like this:


[...]
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

#if [ -f ~/.bash_aliases ]; then
# . ~/.bash_aliases
#fi

# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
fi

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi


alias Opeth="totem ~/M?sica/Opeth/*"
alias adom="~/adom/adom"

Next time you reboot or close session, the aliases you just defined will load again.

coppro
03-12-2008, 01:21 AM
ln -s ~/adom/adom ~/bin/adomAliasing is overrated... private bin directories are not!

That's my choice, anyway. I prefer executables to aliases *shrug*

Epythic
03-12-2008, 06:49 AM
Yay editor war!

Learn to use vim. Its the only right thing.

theotherhiveking
03-12-2008, 12:52 PM
Never! Emacs Is The Way Of The Samurai!

Alucard
03-12-2008, 12:54 PM
Or add ADOM's bin dir to your $PATH.

Also, nano sucks, $EDITOR is the best.

coppro
03-13-2008, 01:17 AM
Real programmers use butterflies (http://www.xkcd.com/378/).

theotherhiveking
03-13-2008, 12:12 PM
Real programmers use butterflies (http://www.xkcd.com/378/).

AHHAH Great! I had a good laugh!

Epythic
03-13-2008, 10:18 PM
So you are reading xkcd too... actually, I was just waiting for that to happen.

Emacs still sucks.

theotherhiveking
03-13-2008, 10:29 PM
I think that everybody that has ever used a console editor reads it.

theotherhiveking
03-13-2008, 10:33 PM
http://imgs.xkcd.com/comics/ultimate_game.png