Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable problem

Status
Not open for further replies.

Arrumac

Technical User
Jan 30, 2002
8
0
0
GB
In a script I declare several variables at the start eg
sysadmin=servername1
project1=servername2
project2=servername3 etc etc
Sysadmin have access to all servers, project 1 people have accounts on their servers only and so on. In the later part of the script I interrogate the third party security software I use and get a value like 'project2:bloggsj'. Its easy enough to strip out the username, bloggsj or the server group project2 as a variable. What I want to achieve is when the server group variable equals the corresponding variable set at the start of the script then run an rsh command to that server where that person will have an account. (This is for a helpdesk script I am writting where the HD analysts are not allowed to have full Security access).

clear as mud...

Adam
 
Sounds like you want to do a string comparison?

if [ "$SERVER_GROUP" = "$STARTUP_VAR" ]
then
echo "Do some action here."
fi Robert G. Jordan
Unix Sys Admin
Sleepy Hollow, Illinois U.S.A.
sh.gif


FREE Unix Scripts
 
It sounds to me like you need to put either projects or servers into a case statement, and then compare the other. Something like:

case "$PROJECT" in
project1) rsh server2...
;;
project2) rsh server3...
;;
esac

But, then again, I may not be following what you're trying to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top