user@host:~> help command
command: command [-pVv] Kommando [Argument ...]
Execute a simple command or display information about commands.
Runs COMMAND with ARGS suppressing shell function lookup, or display
information about the specified COMMANDs. Can be used to invoke commands
on disk when a function with the same name exists.
Options:
-p use a default value for PATH that is guaranteed to find all of
the standard utilities
-v print a description of COMMAND similar to the `type' builtin
-V print a more verbose description of each COMMAND
Exit Status:
Returns exit status of COMMAND, or failure if COMMAND is not found.
command echo "BlubberPlapper"
# Hilfe für "if"
user@host:~> help if
if: if Kommandos; then Kommandos; [ elif Kommandos; then Kommandos; ]... [ else Kommandos; ] fi
Execute commands based on conditional.
The `if COMMANDS' list is executed. If its exit status is zero, then the
`then COMMANDS' list is executed. Otherwise, each `elif COMMANDS' list is
executed in turn, and if its exit status is zero, the corresponding
`then COMMANDS' list is executed and the if command completes. Otherwise,
the `else COMMANDS' list is executed, if present. The exit status of the
entire construct is the exit status of the last command executed, or zero
if no condition tested true.
Exit Status:
Returns the status of the last command executed.
# Hilfe zu Befehlen, wie "[["
# Man beachte, dass diese Befehle gequotet werden müssen, damit sie nicht von
# der rufenden [b]bash[/b] fälschlicherweise geschluckt werden. Das gilt natürlich auch
# für "(" "[" "&&" etc....
user@host:~> help "[["
[[ ... ]]: [[ Ausdruck ]]
Execute conditional command.
Returns a status of 0 or 1 depending on the evaluation of the conditional
expression EXPRESSION. Expressions are composed of the same primaries used
by the `test' builtin, and may be combined using the following operators:
( EXPRESSION ) Returns the value of EXPRESSION
! EXPRESSION True if EXPRESSION is false; else false
EXPR1 && EXPR2 True if both EXPR1 and EXPR2 are true; else false
EXPR1 || EXPR2 True if either EXPR1 or EXPR2 is true; else false
When the `==' and `!=' operators are used, the string to the right of
the operator is used as a pattern and pattern matching is performed.
When the `=~' operator is used, the string to the right of the operator
is matched as a regular expression.
The && and || operators do not evaluate EXPR2 if EXPR1 is sufficient to
determine the expression's value.
Exit Status:
0 or 1 depending on value of EXPRESSION.
# Der Befehl zeigt, dass selbst der Bedingungsteil von "if" aus mehreren Kommandos bestehen kann:
if ls ; echo "hubert"; ((2<3)) ; then echo "zwei ist kleiner als drei"; else echo"zwei ist gößer als drei" ;fi
# (über mir ist nur eine Zeile Kommentar. und eine einzige lange Zeile Code.)
#Was das IF dann letztlich für wahr oder falsch hält, entscheidet einzig und alleine der RETURNCODE des letzten Kommandos
# Entscheided ist also der artihmetische Ausdruck ((2<3))
# Da dieser immer 0 (zero) zurückgibt, was "wahr" bedeutet, wird der "then" Zweig ausgeführt.
user@host:~> help "(("
(( ... )): (( Ausdruck ))
Evaluate arithmetic expression.
The EXPRESSION is evaluated according to the rules for arithmetic
evaluation. Equivalent to "let EXPRESSION".
Exit Status:
Returns 1 if EXPRESSION evaluates to 0; returns 0 otherwise.
# einfacher arithmetischer Vergleich
((1==1))&&echo "Jawohl."||echo "nö!"
# In vorheriger Zeile ist alles schön eng unleserlich geschrieben, was möglich ist, solange das syntakisch möglich ist.
[ 1 -eq 1 ] && echo "Jawohl." || echo "nö."
# Jetzt wäre ein [1-eq1] nicht gegangen, weil die BASH nur ein Token "1-eq1" erkannt hätte.
# beide Varianten funktionieren auch mit "[["
[[1 -eq 1 ]] && echo "Jawohl." || echo "nö."
[[1 == 1 ]] && echo "Jawohl." || echo "nö."
# und schlußendlich mit "if"
if ((1==1)); then echo "jou."; else echo "Nö."; fi
if [ 1 = 1 ]; then echo "jou."; else echo "Nö."; fi
if [[ 1 == 1 ]]; then echo "jou."; else echo "Nö."; fi
#jede der drei vorangehenden "If" Konstruktionen lässt sich auch ohne Semikola schreiben:
if [[ 1 == 1 ]]
then echo "jou."
else echo "Nö."
fi
# oder in gemischter Form
if [[ 1 == 1 ]] ; then
echo "jou."
else echo "Nö."
fi
Nur so nebenbei: Statt "man:Kommando" kann man auch "#Kommando" eingeben.uhelp schrieb:Öffnet eueren "Konqueror", der sich meist im Menu unter Internet/Webbrowser findet und gebt dort in die Adresszeile
"man:Kommando", oder "info:Kommando" ein.