From: Ertugrul Soeylemez on 20 Jun 2006 17:20 "Chris F.A. Johnson" <cfajohnson(a)gmail.com> (06-06-20 13:47:12): > > > But why the hassle? You can script useradd to do the job more > > > easily for you. As usual the fine manual 'man useradd' has the > > > info. > > > > Yes, and it's also more portable > > It is not portable; there are different versions, with different > syntax, even among Linux distros. Other *nixen may not have it at > all. I didn't say it's portable. I said, it's _more_ portable. Editing /etc/passwd directly may even be unportable on the same distribution with a different version. Regards, E.S.
From: Ertugrul Soeylemez on 20 Jun 2006 18:07 Michael Heiming <michael+USENET(a)www.heiming.de> (06-06-20 02:08:25): > > There is nothing improper about a Windows text file; the standard > > allows CR/LF line endings. Most programs don't handle them properly. Even some text editors (like GNU nano) fail there. One reason is that functions like fgets() do return the CR character as part of the line. > Just that it sucks if you edit/transfer text on one and copy to > the other. Strange enough there's zero problem between any kind > of unix system. Just M$ has this problem, perhaps because it > isn't an OS but a fine? ;-) Same with delimiter characters. Where Unix uses ':', Windows uses ';', and where Unix uses '/', Windows uses '\'. Even basic system functions names are totally incompatible, like poll() on Unix vs. MsgWaitForMultipleObjectsEx() on Windows. Microsoft has sufficiently reached the goal of making Windows programs as unportable as possible. Wouldn't it be bad, if Photoshop ran equally well on Unix? Ten screenfuls of source code just to create an empty OpenGL- or D3D-enabled window via DirectX under Windows. A few more pages of code, to make it closable. And you couldn't remember all those COM+ calls needed, without having a browser to MSDN open. You couldn't even remember their argument list. Even if you do for a single function; what kind of argument is it? LPARAM, or DOWRD? Or even WINDOWCLASSEX? Or CREATESTRUCT? Oh, please don't forget, you have to use LPCTSTR instead of char *. And (writing this in an own paragraph because of identifier length) please remember that the FrontEndUploadMemoryUtilizedPercent component of the D3DDEVINFO_D3D9BANDWIDTHTIMINGS structure is of type FLOAT, not float! Same program in Unix via SDL uses just about thirty lines, and can be done mostly with standard types. Poor Windows coders ... Regards, E.S.
From: Unruh on 21 Jun 2006 04:32 "Ross" <nospam(a)ross.com> writes: >Hi there, >I am going to create 9000 users. >I have all the user names in a txt file userlist.txt like this: >user_1 >user_2 >: >user_9000 Do your user names actually have the numbers int he names or are there just 9000 different names? i=1000 for n in `cat nameoffile` do echo "$n:x:$i:1000::/home/$n:/bin/bash">>/etc/passwd i=$(($i+1)) done >I want the passwd file to be created like this: >user_1:x:1001:1000::/home/user_1:/bin/bash >user_2:x:1002:1000::/home/user_2:/bin/bash >: >user_1000:x:1001::/home/user_2000:/bin/bash >: >user_9000:x:1009::/home/user_9000:/bin/bash >How could I use bash with something like awk to create the passwd file? >And also the group, shadow files (all passwords can be the same)? >Thanks, >Ross
From: KernelPanic on 24 Jun 2006 10:01 Finally someone with the reasonable answer. If he's working from a text file with "^M" imbedded, he could A) vi the file and perform a global search and replace, or B) pipe the output to sed using '/s[CTRL][v][CTRL][M]//g' to remove the "^M" before using the useradd command. "Ertugrul Soeylemez" <never(a)drwxr-xr-x.org> wrote in message news:e77be1$gmq$03$1(a)news.t-online.com... > Michael Heiming <michael+USENET(a)www.heiming.de> (06-06-19 23:24:09): > >> But why the hassle? You can script useradd to do the job more easily >> for you. As usual the fine manual 'man useradd' has the info. > > Yes, and it's also more portable and optionally allows automatic home > directory creation based on a template, and so on. You shouldn't tamper > with /etc/passwd, /etc/group and /etc/shadow, unless you have a good > reason to do so. Use system tools instead. > > To get you started: > > for n in `seq 0 8999`; do > useradd -u $((1000 + $n)) -g $((1001 + $n / 1000)) user_$((1000 + $n)) > done > > > Regards, > E.S.
From: Floyd L. Davidson on 24 Jun 2006 13:04 "KernelPanic" <myngreader(a)verizon.net> wrote: >Finally someone with the reasonable answer. If he's working from a text >file with "^M" imbedded, he could A) vi the file and perform a global search >and replace, or B) pipe the output to sed using '/s[CTRL][v][CTRL][M]//g' to >remove the "^M" before using the useradd command. That is exactly what /col/ was designed to do. Pipe the file through /col/, using -x and perhaps -b options. -- Floyd L. Davidson <http://www.apaflo.com/floyd_davidson> Ukpeagvik (Barrow, Alaska) floyd(a)apaflo.com
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: dhcpd.conf setup Next: prism 2.5 chipset config. 4 ubuntu |