Quantcast
Channel: Multimediaforum
Viewing all articles
Browse latest Browse all 4603

Befehl "if" in Verbindung mit logischem Operator

$
0
0
Liebe Experten,

ich möchte folgendes Kommando absetzen (der 1. Teil mit "console" hat schon immer funktioniert):

Code:

if [ $(who | grep -c console) -eq "0" -a $(who | -c $DISPLAY) -eq "0"];
Dann kommt die FM: "... [ :missing ']'

Code:

if [[ $(who | grep -c console) -eq "0"] -a [$(who | -c $DISPLAY) -eq "0"]];
ergibt dann aber: "syntax error in conditional expression, syntax error near '-a', danach wird die ganz Kommandozeile wiederholt

versuche ich
Code:

if [( $(who | grep -c console) -eq "0") -a ($(who | -c $DISPLAY) -eq "0")];
kommt die FM: "syntax error near unexpected token 'who | grep -c console'", danach wird wieder die ganze Kommandozeile wiederholt

Schön langsam gehen mir die Kombinationsmöglichkeiten aus. Hat jemand eine Idee ?

LG
Georg

Viewing all articles
Browse latest Browse all 4603