4

I've seen in another post which shows how to use tee and logger as shown below.

tee >(logger) <<< "System Load is OK : $Current_loadadv"

>(logger) is bash syntax to create a file descriptor that is going to a FIFO, which is then fed to the standard input of logger (this is one form of what is known as "process substitution" in bash). It then passes back the path to that file descriptor as an argument to tee, and since tee writes to its non-option arguments, the FD is written to, and logger receives your string.

How can I modify the following command to use tag and logger above?

curl -Sks  http://x.x.x.x/scripts/somescript.sh | /bin/bash | logger -t "sometag"
8

Simply pipe bash to tee. Or did I misunderstand the problem?

root@el6 ~ # cat test.sh 
date

root@el6 ~ # cat test.sh | bash | tee >(logger -t "test")
Wed Jul 10 23:08:03 NZST 2013

root@el6 ~ # tail -n3 /var/log/messages
Jul 10 23:08:03 el6 test: Wed Jul 10 23:08:03 NZST 2013
  • 3
    don't need bash just use cat test.sh | tee >(logger -t "test") – Rahul Patil Jul 11 '13 at 6:45
  • @RahulPatil - I guess he needs bash there because he wants to download and execute the script in one go. – MLu Jul 11 '13 at 9:07
  • may be.. I have not tested.. – Rahul Patil Jul 11 '13 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.