[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Korn Shell arrays

Asked by j8vy in Unix Systems Programming

Tags: kick

Good morning all,

I have a script that I wrote this morning that I can not figure out how to finish. This script will be used to kick a user out of my application. My goal is to prompt the user for the username of the person that they wish to kick off, retain that username in a variable, load in the userid associated with that username, and then use the userid to remove them from the system. My problem is, I want to propmt the user for the username, but the only way that I can kick someone out of the application is via the userid.

I am trying to take the following output:

UID  user  The rest is really useless information for this purpose ...
365  jx5h  T00A1AD.opr.statefarm.org  ECS_GUI  03/13/03 08:41:49:389920
447  jx5h  T0093E5.opr.statefarm.org  ECS_GUI  03/17/03 18:12:23:268080
450  c8zg  T000FDA.opr.statefarm.org  ECS_GUI  03/18/03 07:18:17:484342

retrieved with the following command:

ecs.ctl -U $euser -P $epass -C GUI_Server -M sf40ctm1 -cmdstr PGUI |grep -v Open |grep -v have |grep -v The

and feed the uid into the following command to remove them from the app:

ecs.ctl -U $euser -P $epass -C GUI_Server -M sf40ctm1 -cmdstr KICK $uid

Note: Currently I am printing some info to the user about the program, prompting
them for a username, and verifying that the username entered is currently logged
in to the application, and futher giving them only three attempts to enter a valid
username.

The following is what I have so far:

#!/usr/bin/ksh

logo="Remove ECS Users"

prmpt() {
clear
print "\n\t\t\t+----------------------------+"
print "\t\t\t|      ${logo}      |"
print "\t\t\t|\t - $(hostname) -\t     |"
print "\t\t\t+----------------------------+"
print "\n\n\n\n\n\tThis program will allow you to 'Kick' a user off of ECS."
print "    Please do not kick a user off of ECS without notifying them first!"
print "\n\tEnter the the userid of the person to be removed below."
print "\t        The userid will be the same as the SFID."
print "\nUserid -> \c"
read userid
}

pgui_out="/opt/incontrol/sf_scripts/admin/j8vy/pgui_rpt.txt"
euser=$(awk '{print $4}' /opt/incontrol/sf_scripts/xfile)
epass=$(awk '{print $5}' /opt/incontrol/sf_scripts/xfile)

set -A id $(ecs.ctl -U $euser -P $epass -C GUI_Server -M sf40ctm1 -cmdstr PGUI |grep -v The |grep -v have |grep -v Open |awk '{print $2}')

prmpt
cnt="-1"
while [[ ${userid} != ${id} ]]; do
if [[ ${cnt} < 2 ]] && [[ ${cnt} > "-1" ]]; then
   print "\nOops ... That user is not currently logged in!"
   print "Please enter a valid userid."
   sleep 3
  prmpt
elif [[ ${cnt} = 2 ]]; then
   print "\nYou have reached the maximum number or retries!"
   print "Please try again at a later time.\n"
   exit 1
fi
 let cnt+=1
done

Your thoughts are appreciated.
P.S. I would prefer to keep this in Korn Shell if it is possible. Thanks.
[+][-]03/21/03 03:11 AM, ID: 8179983Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/21/03 04:49 AM, ID: 8180436Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/21/03 11:49 AM, ID: 8183222Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/21/03 11:54 AM, ID: 8183251Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/21/03 02:32 PM, ID: 8184248Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/24/03 10:01 PM, ID: 8200570Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/25/03 04:13 AM, ID: 8202134Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/25/03 06:50 AM, ID: 8203128Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/25/03 07:45 AM, ID: 8203568Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Unix Systems Programming
Tags: kick
Sign Up Now!
Solution Provided By: HamdyHassan
Participating Experts: 3
Solution Grade: A
 
[+][-]03/25/03 10:54 AM, ID: 8204908Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/25/03 10:56 AM, ID: 8204922Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/26/03 07:19 AM, ID: 8211014Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89