Milan
Milan

Reputation: 1529

How to redirect echo V >/dev/watchdog1 to a file

I would like to redirect output of following command to a file in shell script:

echo V > /dev/watchdog1 

Above command gives me following message on console

"watchdog stopped"

and I wanted to capture this in a file.

Tried this:

echo V > /dev/watchdog1 > output.txt

But this doesn't capture anything in output.txt.

Is there a way to do it?

Upvotes: 0

Views: 161

Answers (1)

knittl
knittl

Reputation: 265727

You can use the tee command to write to a file and at the same time write to standard output. Combined with a second redirection, this should allow you to write two files at the same time:

echo V | tee /dev/watchdog1 > output.txt

Upvotes: 1

Related Questions