June 27, 2007
How can you put the output of the following command into the variables provided?
DATE for the output of "date" command
- USERS for the output of "who | wc -l"
- UP for the output of "date; uptime"
- (Red Hat Linux)
- Assuming you are talking about shell scripting or shell commands in Red Hat Linux:
DATE=`date`;
USERS=`who | wc -l`;
UP=`date; uptime`;Note the ` used above is not the single quote, but the backtick (the key to the left of the "1" on standard keyboards).
To confirm that it worked, you can use:
echo $DATE;
echo $USERS;
echo $UP;
Tags: linux driver, linux























