Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
(Erledigt) Shell / Bash Script erstellen
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum
View previous topic :: View next topic  
Author Message
fn_dark
n00b
n00b


Joined: 22 Jul 2007
Posts: 29

PostPosted: Wed Oct 31, 2007 11:13 am    Post subject: (Erledigt) Shell / Bash Script erstellen Reply with quote

Hi,

Vorwort

Ich nutze zwar nun mittlerweilen (bin stolz drauf) seid ca 5 oder 6 Monaten Gentoo, muss mich aber noch in soviele Sachen einarbeiten, unteranderem auch in das erstellen von Shell / Bashscripten.

Eigentliche Frage

Ich hab mich da mal rangewagt und wenn das auch eher sinnfrei ist aber für mich eine erleichterung bedeutet ein SH-Script zusammen geschuster womit ich alle 4 Befehle zum Systemupdaten ausführen kann. Mir gefällt aber nicht das das Script alles einfach hintereinander durchraselt!

Nun würde ich da gern eine Nachfrage einbauen wo man lediglich mit Ja oder Nein antworten kann bevor die nächste Aktion ausgeführt wird.

Wie muss die Zeile im SH-Script dafür ausschauen?

Ich bin zwar lernwillig, will aber auch immer wenn möglich aus dem stehgreif was alleine hinbekommen, von daher bin ich sehr dankbar für antworten von euch!

Gruss, Dark


Last edited by fn_dark on Wed Oct 31, 2007 2:21 pm; edited 1 time in total
Back to top
View user's profile Send private message
sirro
Veteran
Veteran


Joined: 20 Jul 2003
Posts: 1472
Location: aachen.nrw.de.eu

PostPosted: Wed Oct 31, 2007 11:27 am    Post subject: Reply with quote

Zeile einlesen (bis Enter)
Code:
read ANTWORT
echo $ANTWORT


Ein Zeichen einlesen:
Code:
read -n 1 ANTWORT
echo $ANTWORT


Mit einem if kannst du dann die Antwort auswerten. Das klappt zumindest in der Bash. (für mehr optionen: man bash und suche nach "One line is read")


Da gab es schon mal einen Thread zu, den ich nicht finde.
Back to top
View user's profile Send private message
fn_dark
n00b
n00b


Joined: 22 Jul 2007
Posts: 29

PostPosted: Wed Oct 31, 2007 2:20 pm    Post subject: re Reply with quote

Hi,

geil'o'mat, das das nich mehr ist! Vielen dank für die Hilfe! Hab zwar jetzt erstmal die einfachere Variante genommen das man halt nur "Enter" drückt damit es weitergeht, aber mit dem IF und so werd mich als nächstes mal auseinandersetzen.

Nochmals, vielen dank. :!:

Gruss, Dark
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum