Sponsored Content
Full Discussion: Bash problem
Top Forums Shell Programming and Scripting Bash problem Post 302258458 by jim mcnamara on Friday 14th of November 2008 03:47:54 PM
Old 11-14-2008
The sed statement returns the first field \1 or group of characters that is not a :
In other words the : acts a as a field separator. The first field of /etc/passwd is the username.

So
"for process in first field name of all records in /etc/passwd" is a start of a for loop that reads thru the passwd file, that sets the process variable equal to each of the usernames in the passwd file, in turn.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash while loop problem

Hi, I'm having a problem with the while loop in bash. I try the following script: #!/bin/bash while true do echo "test" done When I try this, it gives me this error: while: Too few arguments. What am I doing wrong? Thanks (5 Replies)
Discussion started by: Kweekwom
5 Replies

2. Shell Programming and Scripting

problem about '..' in bash

There is an interview question about UNIX bash: Some shells like bash try to make '..' always work propery, namely, from home directory, cd ../$USER will place you in your home directory. Does bash always get this behavior correct? Anyway can provide any example that bash doesnt work well? ... (4 Replies)
Discussion started by: usfish
4 Replies

3. Shell Programming and Scripting

bash problem

I have a ksh script with the following code and working fine under ksh. IFS=$IFS IFS=: while read a b c do test "$a" = "$oraserver" && { orahome=$b; break; } echo $orahome done < /var/opt/oracle/oratab2 IFS=$_IFS ... (13 Replies)
Discussion started by: talashil
13 Replies

4. Shell Programming and Scripting

bash problem with if

#!/bin/bash # This script takes two arguments: <path> and <dir>. It has to copy in <dir> #+ all regular files in <path> with .c extension containining at least one while #+ instruction and one if instruction. if then for file in $(ls "$1" | grep "\.c$") do if # doesn't... (9 Replies)
Discussion started by: Luke Bonham
9 Replies

5. Shell Programming and Scripting

bash problem

hello i am new with linux hello unix forum. i have big problem i want to install the samp server for every user folder for ex.. samp for my frined name fred fredsamp then i want create more samp to my firend lee i want folder name will be leesamp i want to know how make the script put the... (0 Replies)
Discussion started by: mage200
0 Replies

6. Solaris

bash problem?

I am using SunOS 5.9 and have the following outcome when using the sh and bash shells; has anyone else had this: (tests behave differently) bash-2.05$ ksh $ if echo $SHELL; uname -a;; then echo yessssssssssssss; else echo nooooooooooooooo; fi SunOS s036cln001014 5.9 Generic_118558-27 sun4u... (4 Replies)
Discussion started by: Cliffcard
4 Replies

7. Shell Programming and Scripting

Problem with bash if

Hi, i am making a little script that when its invoked with p or f, it will do different things (p will ask the user to input an string and it will count its words , and f will ask the user a directory and will list the number of files in that directory. But if wont get the comparation string... (1 Reply)
Discussion started by: lamachejo
1 Replies

8. Shell Programming and Scripting

zero padding problem (bash)

Hi there, I need to loop some values, for i in $(seq $first $last) do does something here donefor $first and $last, i need it to be of fixed length 5. so if the input is 1, i need to add zeros in front such that it becomes 00001. It loops till 99999 for example, but the length has to be... (4 Replies)
Discussion started by: jremio
4 Replies

9. Shell Programming and Scripting

Problem With Bash Scripting

What's up guys, I am currently trying to figure out the answer to this question and I cannot for the life of me! The question is : "Explain how to do the following in UNIX/Linux shell script. You are not expected to remember the exact command syntax, but explain approximately how you would... (1 Reply)
Discussion started by: malikirl
1 Replies

10. Shell Programming and Scripting

A bash problem

Hi, I'm fairly new to unix, and I have the following problem: I know that if I type, "ps -ef | grep process", this will return some information about the process named 'process'. What I need this to do is be piped to an extra search that pick's out process' PID. How do I do this? Thanks in... (5 Replies)
Discussion started by: bogof_tom
5 Replies
PASSWD(5)						      BSD File Formats Manual							 PASSWD(5)

NAME
passwd, master.passwd -- format of the password file DESCRIPTION
The /etc/passwd file is a legacy BSD 4.3 format file. It is mostly unused, but is updated by some utility programs. Its format is similar to the /etc/master.passwd file, except that it does not contain the class, change, and expire fields described below. The /etc/master.passwd file comprises newline separated records, one per user. Each line contains ten colon (``:'') separated fields. These fields are as follows: name User's login name. password User's encrypted password. uid User's id. gid User's login group id. class User's general classification (unused). change Password change time. expire Account expiration time. gecos User's full name. home_dir User's home directory. shell User's login shell. The name field is the login used to access the computer account, and the uid field is the number associated with it. They should both be unique across the system (and often across a group of systems) since they control file access. While it is possible to have multiple entries with identical login names and/or identical user id's, it is usually a mistake to do so. Rou- tines that manipulate these files will often return only one of the multiple entries, and that one by random selection. The login name must never begin with a hyphen (``-''); also, it is strongly suggested that neither upper-case characters or dots (``.'') be part of the name, as this tends to confuse mailers. No field may contain a colon (``:'') as this has been used historically to separate the fields in the user database. The password field is the encrypted form of the password. If the password field is empty, no password will be required to gain access to the machine. This is almost invariably a mistake. Because these files contain the encrypted user passwords, they should not be readable by any- one without appropriate privileges. The group field is the group that the user will be placed in upon login. Since this system supports multiple groups (see groups(1)) this field currently has little special meaning. The class field is currently unused. The change field is the number in seconds, GMT, from the epoch, until the password for the account must be changed. This field may be left empty to turn off the password aging feature. The expire field is the number in seconds, GMT, from the epoch, until the account expires. This field may be left empty to turn off the account aging feature. The gecos field normally contains the user's full name. Note that Mac OS X differs from some other operating systems, where the gecos field may contain other comma-separcted information about the user. The home_dir field is the user's home directory. This is the full path name where the user will be placed on login. The shell field is the command interpreter the user prefers. If there is nothing in the shell field, the Bourne shell (/bin/sh) is assumed. INTERACTION WITH DIRECTORY SERVICES
Processes generally find user records using one of the getpwent(3) family of functions. On Mac OS X, these functions interact with the DirectoryService(8) daemon, which reads the /etc/master.passwd file as well as searching other directory information services to find user accounts. FILES
/etc/passwd /etc/master.passwd SEE ALSO
chpass(1), login(1), passwd(1), getpwent(3), netgroup(5), DirectoryService(8), pwd_mkdb(8), vipw(8) HISTORY
A passwd file format appeared in Version 6 AT&T UNIX. BSD
July 18, 1995 BSD
All times are GMT -4. The time now is 12:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy