Wie werden Konfigurationsdateien in Bash Scripte eingebunden (include)
Hallo,
ich möchte in einem Bashscript eine Konfigurationsdatei einbinden. Zur Zeit tue ich dies wie folgt:
Inhalt der Datei config.conf:
#Konfigurationsdatei
SSH_PORT=22
HTTP_PORT=80
Inhalt des Bashscriptes:
#!/bin/sh
SSH_PORT=`cat config.conf | grep "SSH_PORT" | cut -c10-14`
HTTP_PORT=`cat config.conf | grep "HTTP_PORT" | cut -c11-15`
echo $SSH_PORT
echo $HTTP_PORT
Ausgabe:
22
80
Das liefert mir zwar genau die Ergebnisse, aber ich denke es gibt eine "effektivere" Methode dafür.
Kann mir jemand Helfen?
Danke.
ich möchte in einem Bashscript eine Konfigurationsdatei einbinden. Zur Zeit tue ich dies wie folgt:
Inhalt der Datei config.conf:
#Konfigurationsdatei
SSH_PORT=22
HTTP_PORT=80
Inhalt des Bashscriptes:
#!/bin/sh
SSH_PORT=`cat config.conf | grep "SSH_PORT" | cut -c10-14`
HTTP_PORT=`cat config.conf | grep "HTTP_PORT" | cut -c11-15`
echo $SSH_PORT
echo $HTTP_PORT
Ausgabe:
22
80
Das liefert mir zwar genau die Ergebnisse, aber ich denke es gibt eine "effektivere" Methode dafür.
Kann mir jemand Helfen?
Danke.
Please also mark the comments that contributed to the solution of the article
Content-Key: 76513
Url: https://administrator.de/contentid/76513
Printed on: April 27, 2024 at 02:04 o'clock
2 Comments
Latest comment