Shell-Skript How-To (Linux)

Aus MattWiki
Die druckbare Version wird nicht mehr unterstützt und kann Darstellungsfehler aufweisen. Bitte aktualisiere deine Browser-Lesezeichen und verwende stattdessen die Standard-Druckfunktion des Browsers.

Diese Seite erläutert verschiedene Verhalten und Verarbeitungen von Shell-Skripten, sowie wie verschiedene Aufgabenstellungen in Linux umgesetzt werden können.

Quotes

Single Quotes vs. Double Quotes

Merksätze zur Erläuterung:

Single quotes are simple quotes, with a single standard: every character is literal. Double quotes have a double standard: some characters are literal, others are still interpreted unless there's a backslash before them.

Single quotes work alone: backslash inside single quotes is not special. Double quotes pair up with backslash: backslash inside double quotes makes the next character non-special.


The double quotes double the fun expanding parameters one by one.


Double-quotes (") don't exactly mean what the say, for example a tool that says "quality" equipment is probably the opposite.

Single-quotes(') are strong quotes, what is between them is exactly what it seems.


Quelle: https://unix.stackexchange.com/questions/400447/whats-a-good-mnemonic-for-shell-double-vs-single-quotes/400449


Backquote

Backquote bezeichnet das folgende Symbol: ``

Verwendet man Backquote in Skripten, wird zunächst der Inhalt des Backquote ausgeführt, und das Ergebnis an das Skript zurückgegeben.

Alternative Notation (Wird allerdings in alten Bourne-Shells wohl nicht unterstützt): $()

Quelle: https://linuxwiki.de/Backquote