By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,806 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,806 IT Pros & Developers. It's quick & easy.

Getopts: user has logged off part not working... help needed....

P: 5
I am trying to write a script with the getopts options. It does everything I want it to except tell me when the specified user has logged off. I am not sure if I set the option wrong or if it is the if untill loop. Here is only part of the script (bash shell).

# process command line options

while getopts mtn: options
case "$options"
m) mailopt=TRUE;;
t) interval=$OPTARG;;
n) logoff=TRUE;;

if [ "$logoff" = TRUE ]
until who | grep -v "^$user" > /dev/null
sleep 60
echo "$user has logged off"

#like I said this is only the part I think has the problem. I also tried....until who | grep "^$user" > /dev/null = FALSE
Dec 8 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.