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.

$ mit oder ohne Anführungszeichen?

Empfohlene Antworten

Veröffentlicht

Hallo,

folgende Frage wird für euch UNIX-Gurus sicherlich leicht zu beantworten sein:

warum verwendet man hier Anführungszeichen

if [ "$success" -eq 0 ]

hier aber nicht:

if [ $yesno != "y" ]

ist es so, dass man beim Vergleich von Zahlen (der ja mit -eq stattfindet) die Variable immer in Anführungszeichen einschließen muss - oder hat es einen anderen Grund?

Gruß,

Technician

P.S.: Ich habe derzeit keinen UNIX-Zugriff, deshalb meine Frage.

Ansonsten wäre es sicherlich ein leichtes, das einfach auszuprobieren!

Ich bin zwar auch nur ein Linux Newbie, aber hab etwas gefunden. (Google - mehr sag ich nicht ;) )

using Quotes to enclose your variables

Sometimes, it is a good idea to protect variable names in double quotes. This is usually the most important if your variables value either (a) contains spaces or (B) is the empty string. An example is as follows:

#!/bin/bash

X=""

if [ -n $X ]; then # -n tests to see if the argument is non empty

echo "the variable X is not the empty string"

fi

This script will give the following output:

the variable X is not the empty string

Why ? because the shell expands $X to the empty string. The expression [ -n ] returns true (since it is not provided with an argument). A better script would have been:

#!/bin/bash

X=""

if [ -n "$X" ]; then # -n tests to see if the argument is non empty

echo "the variable X is not the empty string"

fi

In this example, the expression expands to [ -n "" ] which returns false, since the string enclosed in inverted commas is clearly empty.

http://pegasus.rutgers.edu/~elflord/unix/bash-tute.html

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.