Print a variable in bash script

So I need to print a variable in bash script. I know we can run echo "$variable" command to display a variable in bash prompt. But, I need to print it on screen and put it in a file same time. Is there a single command to do that?

echo "$var" 

I need last command such way to print on screen and put in a file called /tmp/log.txt so I tried this but it will only put in the file and not on screen:

echo "$var"  > /tmp/log.txt

You can use the tee command:

echo "$os" 2>&1 | tee /tmp/output.txt



Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki