Re: Frage zu Alias
Hallo Bjoern!
Bjoern schrieb am Montag, den 02. März 2009:
[Alias]
>> Okay, dass die .bashrc dafür zuständig ist, wusste ich. Nur dachte
>> ich, dass wenn ich ich in der bash eingebe /$alias ll='ls-l'/ es
>> automatisch der .bashrc hinzugefügt wird.
Ich hab dafür eine Wrapperfunktion:
typo(){
# So often I make little stupid typos while firing away
# in the shell. They are very annoying, but it is too
# much trouble to fire up Emacs or nano to manually
# add an alias that would fix the problem. And typing
# the appropriate echo and append command is tedious and
# error prone. So, I whipped up a quick shell script which
# reads the two arguments provided, and constructs the appropriate
# echo command to create an alias that solves that typo.
if [ $# -lt 2 ]; then
echo -e "Usage:\ttypo <wrong-command> <right-command>"
echo -e "\ttakes a typo and creates an alias using the"
echo -e "\tprovided correct command"
else
#It goes typo wrong-command right-command
argfirst="$1"
# so $@ does not contain $1 anymore
shift
echo alias $argfirst=\'"$@"\' >> ~/.bashrc
tail -n 1 ~/.bashrc
. ~/.bashrc
fi
}
>>
>> Kann mir jemand erklären, warum dem nicht so ist?
Weil es nicht so definiert ist.
Grüße
Christian
--
hundred-and-one symptoms of being an internet addict:
131. You challenge authority and society by portnuking people
Reply to: