checking the Unix login id before executing Unix script codes
Posted on 2010-09-19
I currently has a Shell script (running in Bourne ie sh ) but there's been cases where a wrong
Unix id is used to execute this Shell script, so need a little enhancement that will check for
the login id (be it direct login id or "su - xxxxx" id where xxxxx is the desired Unix login id that
can be permitted to run the actual codes.
Kindly recode the following pseudo code with actual Bourne Shell script codes:
loginid=extract this from the 1st column of "id" command's output
if loginid is not "xxxxx"
echo "You used incorrect id to run this script, pls use xxxxx"
run ...my existing codes .....