Sponsored Content
Top Forums Shell Programming and Scripting Loop through usernames 1 by 1 and select Post 302577458 by balajesuri on Tuesday 29th of November 2011 05:55:47 AM
Old 11-29-2011
How did it work? "storeSelectedUser" is not even an array in your script. Try the following:
Code:
#!/bin/sh
i=0 
for username in  `cut -d":" -f1 /etc/passwd`
do
    echo -e "$username - add $username to the list ? (y/n): \c "
    read answer
    if [ "$answer" == "y" ]
    then
        storeSelectedUser[$i]=$username
        i=$(($i + 1))
    fi
done
 
for selUse in ${storeSelectedUser[@]}
do
    echo $selUse
done

 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Usernames and processes most used

I need a command that returns the usernames that have ran the 10 processes that have taken the most time to execute on a machine. I also need a command that returns only those directories that have read/execute permissions for all the users. (4 Replies)
Discussion started by: anw68ster
4 Replies

2. Shell Programming and Scripting

extracting usernames with at least 4 characters

Hi, i want to use grep to extract users with at least 4 characters in their username, i've tried who | grep \{4,\} but thats not working!!!!!! Thanks (4 Replies)
Discussion started by: c19h28O2
4 Replies

3. UNIX for Advanced & Expert Users

Usernames across Applications

Hello everyone, I was just wondering if there was a way to make it so that usernames could be used across applications. For instance, I have a server that has a bunch of users. I want these users to have ways of accessing my database as well as a variety of other programs, but I don't want them... (2 Replies)
Discussion started by: gonzofish
2 Replies

4. UNIX for Advanced & Expert Users

Usernames in Sudoers have #

We have users that have a # in their username. Sudo is working on some servers and not others. I have narrowed it down to the # in their username. Any suggestions or ideas why it is working on 1 server but not another. Server not working is - Solaris 10 patch level 138888-01 Server working is ... (1 Reply)
Discussion started by: Gibby13
1 Replies

5. Shell Programming and Scripting

How to execute a no of SELECT COUNT(*) statements using a loop

HI Unix Gurus, I have a number of SELECT count(*) statements in an input file and I want to execute it using a shell script but one by one using loop in script.... How can I do this..... (7 Replies)
Discussion started by: ustechie
7 Replies

6. Shell Programming and Scripting

Compare file names and select correct elements to include in "for each loop"

Hi everyone, I`ll try to be most clear I can explaining my help request. I have 2 folders Folder A-->This folder receives files through FTP constantly Folder B-->The files from Folder A are unzipped and then processed in Folder B Sometimes Folder A doesn`t contain all... (2 Replies)
Discussion started by: cgkmal
2 Replies

7. Shell Programming and Scripting

how to test input variable is a string in a select loop

Okay -- I hope I ask this correctly. I'm working on my little shell script to write vendor names and aliases to files from user input. If a user choose to add to a file, he can do that as well. I'm using a select loop for this function to list all the possible files the user can choose from.... (7 Replies)
Discussion started by: Straitsfan
7 Replies

8. Shell Programming and Scripting

Select command going to infinite loop after running the script

cd /opt/et/WAS/apps/8.0 find . -name "HostIntegration.properties" -o -name "HostSocket.properties" -o -name "environment.properties" 2> /dev/null | awk -F '' '{print $4}'|awk '!x++' | cat>/home/cbadmin/file1.txt cd /home/cbadmin/ PS3='Please enter a number from list of applications==>:' select... (3 Replies)
Discussion started by: bhas85
3 Replies

9. Shell Programming and Scripting

Storing passing and executing select statement in loop

Hi, i want to do the following: Grep the following kind of strings for the 15digit ID which is stored in filename1: "14:06:51.396 INFO BMCREMEDYSD INPUT-ACTION Failed to retrieve Remedy Incident Modification record: 000000000039047 org.apache.axis2.AxisFault: Read timed out - complete... (9 Replies)
Discussion started by: Khushbu
9 Replies
eurephiadm users(7)													       eurephiadm users(7)

NAME
eurephiadm-users - User management module SYNOPSIS
eurephiadm users --list|-l [-S|--sort <sort keys>] eurephiadm users --show|-s [-i|--uid <user id>] [-u|--username <user name>] [-l|-|-lastlog] [-L|--lastlog-details] [-a|--attempts] [-b|--blacklist] eurephiadm users --activate|-a [-i|--uid <user id>] [-u|--username <user name>] eurephiadm users --deactivate|-d [-i|--uid <user id>] [-u|--username <user name>] eurephiadm users --add|-A [-u|--username <user name>] [-P|--password <plain text password>] [-C|--certid <certificate ID>] [-D|--digest <certificate SHA1 digest>] [-c|--certfile <certificate file>] [-2|--pkcs12] eurephiadm users --delete|-D [-i|--uid <user id>] [-u|--username <user name>] eurephiadm users --password|-p [-i|--uid <user id>] [-u|--username <user name>] eurephiadm users [-h|--help [<mode>]] DESCRIPTION
eurephiadm users manages eurephia user accounts. It provides an interface for listing, creating new, modify and delete user accounts. MODES
Available modes: -l | --list [-S|--sort <sort keys>] List all user accounts. Providing -S|--sort and a sort key will define the sort order of the list. Valid sort keys are: uid - user ID username - User name belonging to the user account activated - When the user account was activated deactivated - When the user account was deactivated lastaccess - When the user account was last used -s | --show [-i|--uid <user id>] [-u|--username <user name>] [-l|--lastlog] [-L|--lastlog-details] [-a|--attempts] [-b|--blacklist] Show user account details. --uid or --username are required. The other arguments only defined which kind of information to show. -a | --activate [-i|--uid <user id>] [-u|--username <user name>] Activate a user account. --uid or --username is required. -d | --deactivate [-i|--uid <user id>] [-u|--username <user name>] Deactivate a user account. --uid or --username is required. -A | --add [-u|--username <user name>] [-P|--password <plain text password>] [-C|--certid <certificate ID>] [-D|--digest <certificate SHA1 digest>] [-c|--certfile <certificate file>] [-2|--pkcs12] Add a new user account. --username is required. If you want to assign a password for the new user account via the command line, provide the password with --password. To associate this user account against an already regstistered certificate, it can be done by either refering to the certificate ID in eurephia using --certid or providing the certificate SHA1 digest/fingerprint to --digest. A brand new certificate can be registered and linked to the user account directly if you have access to the certificate file. The file can be in either PEM/DER format or PKCS#12. Use --certfile to indicate the certificate file to extract the information from and --pkcs12 if it is a PKCS#12 file. -D | --delete [-i|--uid <user id>] [-u|--username <user name>] Delete a user account. --uid or --username is required. -p | --password [-i|--uid <user id>] [-u|--username <user name>] Change password on a user account. --uid or --username is required. -h | --help [<mode>] Show a help screen. Without any arguments, all modes are listed. Providing a mode will show more information about the chosen mode. SEE ALSO
eurephiadm(7), eurephiadm-certs(7) AUTHOR
Copyright (C) 2008-2010 David Sommerseth <dazo@users.sourceforge.net> David Sommerseth July 2010 eurephiadm users(7)
All times are GMT -4. The time now is 06:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy