A couple issues


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting A couple issues
# 1  
Old 04-15-2011
A couple issues

Hello, I have a couple questions. First of all, I'm trying to use the wc command on the /etc/passwd file to find out the total amount of users but I am unsuccesful. I figured since users each have their own line in the passwd file that i could have it count the number of lines and then return the number and that number would be my total amount of users in the system. Also, this may seem like a stupid question but how do i save or overwrite a file in a shell script?

Thanks
# 2  
Old 04-15-2011
A simple cat /etc/passwd | wc -l will give the total system users.

However, if are you trying to separate actual user's from system usernames?

You will need to test $UID's above the base user ID number, depending on your distro.

In my Fedora 13 system the base user ID is 500, and in my ubuntu 10.04 system, the base user ID is 1000.
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to couple 2 script in 1?

I have two script / test1 - test2 test1 in var / etc test2 in var / www and I want coupled into a single script that runs both script in the following order test1 and test2 every 3 minutes (7 Replies)
Discussion started by: azzeddine2005
7 Replies

2. Solaris

Couple logadm questions

My logadm.conf is below. Is there a way to match a log file that appends the time/date stamp after the log file? Also, a 0 is being appended onto the files I'm compressing and having rotated. Is there a way to fix that? /var/apache/tomcat55/logs/catalina.out -C 30 -P 'Fri Jun 18 16:48:55... (5 Replies)
Discussion started by: LittleLebowski
5 Replies

3. HP-UX

Couple of questions.

Right now I am a Microfocus COBOL programmer, working on a HP-UX system. I want to now get Certified as a HP Certified Systems Administrator. I ordered a book from amazon and will start with it. I also will be working at my job with someone who applies the patches and things as we do NOT have a... (3 Replies)
Discussion started by: nixie21
3 Replies

4. Shell Programming and Scripting

need couple of ksh tricks please

1) I ran myScript with 2 arguments, I meant to use 3 if I do r my, it will rerun it with the 2 arguments. is there a way I can do r my and add a third argument at the end? 2) say I did myAcript.ksh 2 5 7 8 I realise my typo. is there an easy way to redo the command replacing A with S? ... (4 Replies)
Discussion started by: JamesByars
4 Replies

5. Debian

A couple of grub questions.

1) After I install a new kernel in Debian Sarge, it updates my menu.lst file for grub, but incorrectly. It assumes it should boot from partition hd0,0, but this is incorrect. How do I change this faulty assumption? 2) If grub fails to find a kernel, grub allows me to enter a path to... (1 Reply)
Discussion started by: akbar
1 Replies
Login or Register to Ask a Question