Befehle an das Terminal senden

T

theOne

Mitglied
Thread Starter
Dabei seit
08.03.2003
Beiträge
85
Reaktionspunkte
0
hallo zusammen

hoffe ihr könnt mir bei meinem problem helfen. wie ich befehle von applescript an das terminal sende weiss ich (do script"login" zb) wie kann ich jetzt aber weitere befehle an das gleiche fenster im terminal senden? (wenn ich einfach do script"ls" zb mache, so öffnet er mich immer wieder ein neues fenster)

das zweite problem ist wie kann ich eingaben von applescript an das terminal senden (zb ich mache do script"login" ) wie kann ich ihm nun vom scirpt her das login und das passwort übergen, so das ich danach eingeloggt bin?

mfg
theONe
 
meinst du das?

tell application "Terminal"
do script "
echo hallo
echo hallo2"
end tell
 
oder so, mit heredocument, dann werden die befehle gleich hintereinander ausgeführt.

tell application "Terminal"
do script "/bin/bash << EOT
echo hallo
echo hallo2
EOT"
end tell
 
nein, wenn ich zb einen befehl als root ausführen will, kann ich das ja von as her so lösen: do script*login root". das problem ist jetzt einfach, dass ich das passwort dann nicht auch via as eingeben kann sondern nur direkt im terminal


mfg
theONe
 
das was ich genau suche ist ja sowas wie
do shell script "command" password "pass" with administrator privileges
doch leider funktioniert das nicht.

mfg
theONe
 
du kannst ja auch das selbe fenster ansprechen

do script: Run a UNIX shell script or command
do script plain text -- data to be passed to the Terminal application as the command line
[with command plain text] -- data to be passed to the Terminal application as the command line, deprecated, use direct parameter
[in reference] -- the window in which to execute the command


oder schau mal in dem link oben, da hat es was mit login
 
hab leider keine erfahrung damit, sehe gerade nicht wie man parameter übergeben könnte.

denn das

do script: Run a UNIX shell script or command
do script plain text -- data to be passed to the Terminal application as the command line
[with command plain text] -- data to be passed to the Terminal application as the command line, deprecated, use direct parameter
[in reference] -- the window in which to execute the command

funktioniert irgenwie nicht (musst evt. etwas pröbeln)

notlösung:
ich würde versuchen die varible mit applescript in ein text datei zu schreiben und dann in der shell wieder aus lesen, irgendwie so: SHELLVAR=$(cat datei_mit_variable)
 
Zurück
Oben Unten