Frage

How to write a string to file and to stdout on console?

If I do

echo "hello" > logfile.txt

I view only hello in logfile.txt but how can I write hello also on console of Linux?

War es hilfreich?

Lösung

Use the tee command:

echo "hello" | tee logfile.txt

Andere Tipps

You can use >> to print in another file.

echo "hello" >> logfile.txt
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top