LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Execute one by one (https://www.linuxquestions.org/questions/linux-general-1/execute-one-by-one-789652/)

jeesun 02-17-2010 04:17 AM

Execute one by one
 
I want to write a shell script which will simultaneously collect OS user information and write in an individual text files.

Can anyone tell me the syntax of the script.

N.B. The user name will be mentioned in an array within the shell script.

pixellany 02-17-2010 04:27 AM

What is the context of this? e.g. how will this be used?

What specific information do you want to collect? (Give an example of a command that will be used in the script)

jeesun 02-17-2010 04:33 AM

to collect users history

pixellany 02-17-2010 04:37 AM

Please give me a complete answer to my question!!

For example, collect user's history for what purpose?

What is an example of a command that you want to run? (Or perhaps a log file?) What specific data about the user are you looking for?

jeesun 02-17-2010 04:47 AM

>> collect user's history for what purpose?
For reporting purpose

>>What is an example of a command that you want to run?
cat command to view users history

>>What specific data about the user are you looking for?
All history or may be there will some option to ask which command i wanna search for.

pixellany 02-17-2010 05:04 AM

I'm sorry, but you are going to have to provide more information for anyone to give you much help.

Have you looked in the various logs in /var/log?

Here is an example of some commands---do any of these relate to what you are trying to do?
http://www.thegeekstuff.com/2009/03/...stem/#more-435

Quote:

cat command to view users history
The "cat" command is used to read and/or combine multiple files--it will not tell you anything about user history.

Quote:

For reporting purpose
reporting WHAT??? You have to tell us what information about the user you are looking for!!!!

mesiol 02-17-2010 05:26 AM

Hye

this definitely sounds like home work.

@jeesun: defining nothing and not answering questions the correct way, not showing what you did before asking here, does not show that you are a Linux user willing to learn anything.

If you do not know anything about shell scripting and syntax, you should first read Bash programming guide. After that play around with what you wanna do, then come back with real questions.

Sorry if my answer is not very polite, but i read dozens of such questions every day here.

jeesun 02-17-2010 05:55 AM

No, its not like that home work.

I'm just really stuck to write the shell script.

I have some users in an array
USRS="jeesun jeesunb jeesunc"

While I read the users using for...do loop it only read one user from USRS array and shows the output.

for uss in $USRS
do

I just forgot the exact loop which will read users from USRS one by one and execute until the last one.

pixellany 02-17-2010 06:01 AM

Quote:

I have some users in an array
USRS="jeesun jeesunb jeesunc"
That does not look like an array.....

To iterate thru a list that is stored in a variable like this:
Code:

for name in $(echo $USRS); do
  echo $name
done

NOW: Please tell me why you won't answer my other questions!!! (e.g. See post #6)


All times are GMT -5. The time now is 03:21 AM.