Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

if then else in BASH

Empfohlene Antworten

Veröffentlicht

hallo, ihr habt mir schon sehr gut in der letzten frage geholfen!

wie sieht eine if anweisung mit else- teil aus??

z.b. so eine

if $1 -gt $2

then

echo "richtig"

else

echo "falsch"

wie sieht diese anweisung richtig aus?

schöne grüsse

Original geschrieben von gurkenpapst

if [ $1 -gt $2 ]

  then

    [i]Kommandos, z.B. [/i]echo "richtig"

  else

    [i]Kommandos, z.B. [/i]echo "falsch"

  fi

sorry dass ich es so genau nehme, so ists besser: ]
if [ $1 -gt $2 ]

  then

    [i]Kommandos, z.B. [/i]echo "richtig"

  else

    [i]Kommandos, z.B. [/i]echo "falsch"

fi

Ging nur um die Formatierung ;)

So finde ich es noch lesbarer. ;)

if [ $1 -gt $2 ]; then
Kommandos, z.B. echo "richtig"
else
Kommandos, z.B. echo "falsch"
fi[/PHP]

  • 7 Jahre später...

Hallo,

kann mir bitte jemand sagen, wofür das fi steht?

einen schönen Tag noch.

lambo

Bearbeitet von lambo

Hallo lupo49,

super. Danke für die schnelle Antwort!

lambo

Nice FORKBOMB im Profil :D

ps.

Man sollte aber darauf achten, dass $1 -gt $2 nur numerische (int) Werte auswertet.

gegeben

A="Test"

B="TEST"

if [ "$A" = "$B" ] ; then

    echo A=B

else

   echo A!=B

fi

Stringvergleich :)

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.