Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I used below options in script to print on terminal as well as /var/log/messages

echo "System Load is OK : $Current_loadadv"
echo "System Load is OK : $Current_loadadv" | logger

but how can i do that in single line ?

share|improve this question
up vote 4 down vote accepted
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.

share|improve this answer
nice , thanks :-) – Rahul Patil Dec 24 '12 at 10:55
@RahulPatil: I don't know if that's actually the case, but as a mnemonic to remember tee, think of the letter T, it looks like a circuit splitter :) – Emanuel Berg Dec 25 '12 at 5:00
@EmanuelBerg Yes, that's the origin of the name tee. – Chris Down Dec 25 '12 at 11:22

Another Option :

logger -s "Message"

man logger

-s Log the message to standard error, as well as the system log.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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