Hallo Georg,

> Gibt es eine Möglichkeit - in einem Skript-Editor oder etwas ähnlichem - 
> einen Teil des bash-Skripts zu markieren, um dann nur den markierten Teil 
> auszuführen?

Beim letzten Workshop zu vim habe ich gelernt, dass sowas geht. Es gibt
viele Wege dorthin hier schonmal einer:

http://stackoverflow.com/questions/19883917/execute-current-line-in-bash-from-vim

Du kannst die Zeile einmal ausführen und dann mit dem Cursor zur
nächsten Zeile gehen und dort mit Punkt '.' das Kommando erneut ausführen.

Für ganz knifflige Fälle gibt es einen Bash debugger:
http://bashdb.sourceforge.net/

Statt mehrzeiliger echo kannst Du "here-docs" verwenden
http://tldp.org/LDP/abs/html/here-docs.html

echo "if `tty -s` >> /root/.bashrc   # Fehlt hier ein "?
echo "then" >> /root/.bashrc
echo "  mesg y"  >> /root/.bashrc
echo "  TTY=`tty`  >> /root/.bashrc
echo "else"  >> /root/.bashrc
echo "  TTY="not a tty"  >> /root/.bashrc
echo "fi"  >> /root/.bashrc

wird dann zu

cat << EOM >>  /root/.bashrc
if `tty -s`
then
  mesg y
  TTY=`tty`
else
  TTY="not a tty"
fi
EOM

und damit besser lesbar und wartbar.

Viel Spaß damit und einen schönen Sonntag noch,

-- 
Jonas Stein
_______________________________________________
Trolug_trolug.de mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/trolug_trolug.de

Antwort per Email an