Suppose another person wrote the following one-line shell script:
echo $RANDOM > /dev/tty
QUESTION #1: How can the random number, which is output to the terminal by this script, be captured in a variable?
QUESTION #2: How can this be done in a cron job?
Specific code, whether in ksh or C, would be greatly appreciated.
---------------------------------------------------------------------
REAL LIFE STORY: We use software with concurrent licenses, which are managed on a UNIX server. The vendor supplies a program which simply displays the number of licenses currently being used, but it directs the output to /dev/tty (not stdout/stderr/file), and it is a compiled program so it cannot be directly altered using sudo permissions. I can only assume that the vendor is actively trying to prevent their customers from gathering statistics about their concurrent license usage, because the customer might find out they don't need so many licenses, contract for fewer licenses, and thus the vendor would loose money. The vendor has to provide some mechanism for determining license usage, but it's extremely limited. I would like to gather statistics every 15 minutes, find the maximum concurrent license usage, so we can contract to the vendor for the ideal number of licenses. Any help you can provide would be greatly appreciated. Thanks! --Paul.