Hi dickiebird ;
Sorry about my explanation,i think i didn't explain what exactly i want.
Here is my script i want to run;
if [ $(who |grep -c "^$USER" -gt 1 ]
then
echo '------------------------------'
echo '------------------------------'
echo 'You can not open more than one session'
echo '------------------------------'
echo '------------------------------'
kill -KILL 0
fi
This script works for find more than one sessions and don't let them login.
But when script is run for greping ,grep find also diferent users and kill their sessions as well.But if i can find exact user name it's gonna work as i want and gonna kill only a user who attemps for second session.
I think you'll only accomplish this if you have users with unique names - so change user john to johnz and joe to joef etc etc
;-) Dickie Bird
db@dickiebird.freeserve.co.uk
The real question is "what are your delimiters, i.e, what character immediately precedes 'J' and succeeds 'n'?". I suspect that the space didn't work because the character was in fact a tab. If you have a POSIX version of grep then the expression would be "[:blank:]John[:blank:]" or more broadly "[^[:alnum:]]John[^[:alnum:]]". If you don't have a POSIX version then it is "[^0-9A-Za-z]John[^0-9A-Za-z]".
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.