LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-17-2010, 04:17 AM   #1
jeesun
Member
 
Registered: Aug 2007
Location: Australia
Distribution: RedHat Enterprise
Posts: 82

Rep: Reputation: 15
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.
 
Old 02-17-2010, 04:27 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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)
 
Old 02-17-2010, 04:33 AM   #3
jeesun
Member
 
Registered: Aug 2007
Location: Australia
Distribution: RedHat Enterprise
Posts: 82

Original Poster
Rep: Reputation: 15
to collect users history
 
Old 02-17-2010, 04:37 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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?
 
Old 02-17-2010, 04:47 AM   #5
jeesun
Member
 
Registered: Aug 2007
Location: Australia
Distribution: RedHat Enterprise
Posts: 82

Original Poster
Rep: Reputation: 15
>> 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.
 
Old 02-17-2010, 05:04 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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!!!!
 
Old 02-17-2010, 05:26 AM   #7
mesiol
Member
 
Registered: Nov 2008
Location: Lower Saxony, Germany
Distribution: CentOS, RHEL, Solaris 10, AIX, HP-UX
Posts: 731

Rep: Reputation: 137Reputation: 137
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.
 
Old 02-17-2010, 05:55 AM   #8
jeesun
Member
 
Registered: Aug 2007
Location: Australia
Distribution: RedHat Enterprise
Posts: 82

Original Poster
Rep: Reputation: 15
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.
 
Old 02-17-2010, 06:01 AM   #9
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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)

Last edited by pixellany; 02-17-2010 at 06:13 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C won't execute?!??! ectof Programming 14 05-28-2009 04:24 AM
Execute a command , reboot and then execute another command ganeshp@moris.org Linux - Newbie 3 12-03-2008 12:51 AM
Cannot execute '/etc/rc.S' jmartinph Slackware 2 03-15-2004 01:39 AM
cronjob will not execute. the_rydster Linux - Newbie 3 11-20-2003 03:34 PM
g++ how do i execute? neon Linux - Newbie 5 08-14-2003 03:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration