Storing the stdout output of a command in a variable and displaying it is simple: OUTPUT=$(command) echo $OUTPUT If you have longer running commands where you want to display stdout in realtime and also store it in a variable you can tee the output to stderr: OUTPUT=$(command | tee /dev/stderr) OUTPUT=$(command | tee /proc/self/fd/2) OUTPUT=$(command…
Category: Linux
Installing Tomcat 6 on Debian Squeeze
This post describes how to setup Tomcat 6 on Debian Squeeze. The configured Tomcat serves requests on port 80 without the need of an additional web server. This is especially good for virtual servers (VPS) providing limit memory. It also has multiple virtual hosts configured, each with it’s own webapp with context root / and…
Determine the user who logged on via SSH
Today we had the need to determine the initial id of a user who logged onto a Linux box via SSH and executed the su command. When the su command is issued the effective user is changed and whoami or id commands will report that new user id instead. For anyone who is interested, that…