[solved] wie ermitteln ob /dev/tty beschrieben werden kann
Hallo Jörg und Martin,
Jörg Sommer <joerg@alea.gnuu.de> wrote:
>Martin Schulze <joey@infodrom.org> wrote:
>> Ja, gibt es, zumindest in Bash:
>… und auch in allen anderen Posix‐kompatiblen Shells.
>
>> if [ -t 1 ]
>> then
>> # Terminal vorhanden
>> else
>> # Kein Terminal vorhanden
>> fi
>
>>> Wenn möglich sollte die Lösung unabhängig von der verwendeten
>>> Shell funktionieren.
Habe es nun so gelöst.
--- testmoi.sh ---
#!/bin/dash
if [ -t 1 ]
then
TEEDEV=/dev/tty
else
TEEDEV=/dev/null
fi
LOG=/tmp/logfile.log
exec >$LOG 2>&1
echo "Ausgabe eines Programmes" | tee $TEEDEV
echo "TEEDEV $TEEDEV"
--- testmoi.sh ---
Das funktioniert wie erhofft.
Danke
Frank
--
echo "[100Q]sy[ of beer]so[la[[[No more]P]sg]sc[n]sgdd0=clgx
[ bottle]Pla1!=m]sb[[s]P]sm99sa[lbxloP[ on the wall, ]
PlbxloP[.]P10aP[Take one down and pass it around. ]Pla
1-salbxloP[ on the wall.]P10adPPla0=ylfx]dsfxq"|dc
Reply to: