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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Validation (mulitple params to match)

Status
Not open for further replies.

chris01010

Programmer
Jan 29, 2004
25
GB
Bit of a no brainer probably for most, but i'm banging my head against me monitor at this precise moment in time.

Basically I want to check that the User, is the correct User to run this script against a number of parameters.

i.e.

{

if

[ "env"= "a" ] && [ "node" = "test" ] && [ "User" = "testman" ]

then

./Deploy

else

clear

echo "User$User does not have permission to deliver to this Environment"

echo "
Returning to Main Menu"

sleep 2

fi

}

unfortunately it doesn't seem to validate against the list of params. I have no doubt it's a syntax error. Anybody have any ideas??

Cheers

Chris
 
You need to prefix the variable names with the $ character. So instead of this:

[ "env"= "a" ] && [ "node" = "test" ] && [ "User" = "testman" ]

You have this:

[ "$env"= "a" ] && [ "$node" = "test" ] && [ "$User" = "testman" ]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top