Re: bash: alias mkcd='mkdir $1; cd $1' funktioniert nicht ;(
Salve,
Problem gelöst: Es geht nicht mit alias und natürlich nicht mit bash skripten,
weil diese ein Childprozess sind, welcher am Skriptende beendet wird, somit
wäre ein Skript für ein cd Befehl, der nacher erhalten bleibt nicht nützlich
- sondern mit fuction:
"Functions
Aliases are fine for abbreviating frequently-used commands, but they soon
reach their limits. Imagine you want to create a command that creates a new
directory and immediately descends into it, ie executes mkdir and cd with the
same argument. An alias can't do that since it can't duplicate its command
line argument to use it for both mkdir and cd.
The next more complex labour-saving feature of bash are functions. They are
defined with the command "function". It is followed by the name of the
function with two parentheses "()" and the definition of the function. This
consists of a sequence of commands enclosed in braces. For instance, our
create-and-descend-into-directory function could be defined in the following
way:
function mkcd() { mkdir "$1" && cd "$1"; }
http://www.volkerschatz.com/unix/bash.html
Und was muss man auf dieser Seite lesen:
"If you need information beyond that (and beyond what is on this page), only
bash's man page can help you. The best way to read it is the following:
Type "man bash"
It really is worth it - all 5087 lines of it :)! "
Ich hoffe nicht, das dieses Problem alle 14 Tage auf dieser Liste gepostet
wird und ehrlich, ich habe heute > 30 minuten mit diesem Problem beschäftigt,
bevor ich hier gepostet hatte
- echt gemein, wie sich alias verhält ;)
man alias
Kein Manual-Eintrag für alias vorhanden
Und stattdessen 5087 Zeilen man bash - Wie war das mit teile und herrsche?
function man-alias() { man bash|grep -B2 -A10 alias ;}
man-alias
Tzztzz, an wen muss man sich wenden um einen Textvorschlag für "man alias"
einzureichen? Ein "siehe man bash" würde schon helfen.
Gruss
rob
Reply to: