Bash-Script
-
- Posts: 10
- Joined: 2004-01-19 03:32
Bash-Script
Hi Leute, habe zwei fragen....
Ich will ein Bash-Script schreiben....
Wie kann ich eine Konfigurations-Datei anlegen und einlesen lassen?
Wie kann ich eine mysql-Query starten, dass ich sie im Bash-Script verarbeiten kann?!?
Gruss Henning
Ich will ein Bash-Script schreiben....
Wie kann ich eine Konfigurations-Datei anlegen und einlesen lassen?
Wie kann ich eine mysql-Query starten, dass ich sie im Bash-Script verarbeiten kann?!?
Gruss Henning
-
- Posts: 3840
- Joined: 2003-01-21 01:59
- Location: Sinsheim/Karlsruhe
Re: Bash-Script
Wie kann ich eine Konfigurations-Datei anlegen und einlesen lassen?
Code: Select all
touch config
. config
Ausgabe in eine Variable umleiten?Wie kann ich eine mysql-Query starten, dass ich sie im Bash-Script verarbeiten kann?!?
-
- Posts: 10
- Joined: 2004-01-19 03:32
Schonmal danke
Was bringt die 2. Zeile?touch config
. config
Wie, und dann?Ausgabe in eine Variable umleiten?
Nochmal Danke!!!!
-
- Posts: 3840
- Joined: 2003-01-21 01:59
- Location: Sinsheim/Karlsruhe
Re: Bash-Script
Führt config aus, sofern das eine ausführbare Datei ist (+x).Was bringt die 2. Zeile?
Kannst du die Variable weiter verarbeiten. :)Wie, und dann?
(Zur Info: Genau danach hattest du zu Anfang gefragt. *g*)
-
- Posts: 10
- Joined: 2004-01-19 03:32
Re: Bash-Script
Wie krieg ich es denn in ne Variable? Womit sollte ich das Query machen?
Aber ich meine jetzt ne Configurations-Datei, wie zum Beispiel mit Port + IP etc....
Wie kann ich die nun verwenden ?
Aber ich meine jetzt ne Configurations-Datei, wie zum Beispiel mit Port + IP etc....
Wie kann ich die nun verwenden ?
-
- Project Manager
- Posts: 11182
- Joined: 2003-02-27 01:00
- Location: Hamburg
Re: Bash-Script
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 10
- Joined: 2004-01-19 03:32
Re: Bash-Script
sry, aber die datei hilft mir gar net ;(
-
- Project Manager
- Posts: 11182
- Joined: 2003-02-27 01:00
- Location: Hamburg
Re: Bash-Script
Code: Select all
man bash
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 10
- Joined: 2004-01-19 03:32
Re: Bash-Script
Sry Joe, aber ich kann net sooo gut Englisch ;(
Kannst du mir net 2 kurze Beispiele geben?
BITTE!
Kannst du mir net 2 kurze Beispiele geben?
BITTE!
-
- Posts: 3840
- Joined: 2003-01-21 01:59
- Location: Sinsheim/Karlsruhe
Re: Bash-Script
Wie krieg ich es denn in ne Variable?
Code: Select all
VAR = $QUERY
http://www.mysql.com/documentation/mysq ... Batch_modeWomit sollte ich das Query machen?
Aber ich meine jetzt ne Configurations-Datei, wie zum Beispiel mit Port + IP etc....
Code: Select all
$ cat >> config
#!/bin/sh
PORT = 3000
IP = 217.160.191.190
^C
$ cat >> deinscript.sh
#!/bin/sh
# irgendwas
# Variablen benutzen
$PORT
$IP
^C
$ chmod u+x config deinscript.sh
$ ./deinscript.sh
-
- Posts: 10
- Joined: 2004-01-19 03:32
Re: Bash-Script
Das mit VAR = QUERY klappt nicht!
:(
und das mit dem File versteh ich net ..... :/
SORRY
:(
und das mit dem File versteh ich net ..... :/
SORRY
-
- Posts: 113
- Joined: 2003-12-11 14:47
Re: Bash-Script
im config-file weist du den variablen werte zu:
config:
script:
config:
und im script liest du das file ein.#!/bin/bash
BLA = "blubb"
BLU = "peng"
script:
#!/bin/bash
. config
echo $BLA
echo $BLU
-
- Posts: 10
- Joined: 2004-01-19 03:32
Re: Bash-Script
Code: Select all
#!/bin/bash
BLA = "blubb"
BLU = "peng"