I'm trying to run a batch file in Linux (SuSE 7.1) but it doesn;t seem to be working properly. This file is a series of useradd commands which i generated in Excell on a Windows machine and saved as a text file. The problem is that I'm getting a list of "username not valid" errors while running the batch file in linux. When I try to enter the users one at a time it works well. Q1. Is useradd a problem (i.e. it doesn't work in batch files)? or Q2. Is the linefeed/carriage return used by MS as an end of line causing problems for Linux? If so which of the 2 characters are used in Linux files? Regards Mark P.S. I have about 500 users to create so don't tell me to enter them manually. __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
On Mon, Jan 21, 2002 at 08:28:17AM +0000, Mark A. Tagliaferro wrote:
I'm trying to run a batch file in Linux (SuSE 7.1) but it doesn;t seem to be working properly. This file is a series of useradd commands which i generated in Excell on a Windows machine and saved as a text file. The problem is that I'm getting a list of "username not valid" errors while running the batch file in linux. When I try to enter the users one at a time it works well.
Q1. Is useradd a problem (i.e. it doesn't work in batch files)?
No. useradd works in shell scripts (Unix name for DOS batches) fine.
or Q2. Is the linefeed/carriage return used by MS as an end of line causing problems for Linux? If so which of the 2 characters are used in Linux files?
Unix uses just linefeed (0x0a) as end of line. DOS uses linefeed+CR (0x0a0x0d). The easiest way to convert your script generated in Windows to Linux is dos2unix command. -Kastus
I actually managed to solve this myself a few hours after I sent the e-mail. Useradd works perfectly with batch files. The problem was as I expected that Windows uses both the linefeed and the carriage return characters at the end of a line while linux uses just one of them. (at the moment i forget which) I just downloaded a hex editor, changed the unwanted character to a space character and saved the new text file. Tranfered to linux, set to an executable and hey presto my users were created. Apparently the application dos2unix on linux does this automatically for you. I found out too late though. :( Regards Mark --- "Mark A. Tagliaferro" <be_lak@yahoo.co.uk> wrote: > I'm trying to run a batch file in Linux (SuSE 7.1) but it doesn;t seem to be
working properly. This file is a series of useradd commands which i generated in Excell on a Windows machine and saved as a text file. The problem is that I'm getting a list of "username not valid" errors while running the batch file in linux. When I try to enter the users one at a time it works well.
Q1. Is useradd a problem (i.e. it doesn't work in batch files)? or Q2. Is the linefeed/carriage return used by MS as an end of line causing problems for Linux? If so which of the 2 characters are used in Linux files? Regards Mark
P.S. I have about 500 users to create so don't tell me to enter them manually.
__________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com - To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
__________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
On Mon, 28 Jan 2002 08:47:28 +0000 (GMT), "Mark A. Tagliaferro" <be_lak@yahoo.co.uk> wrote:
e-mail. Useradd works perfectly with batch files. The problem was
Yeah, I have that same problem when I save scripts from emails. One semantic error I must point out, though: in Unix, they're called shell scripts or just scripts. Batch is specific to DOS/Windows. --Jason V. C.
On Tuesday 29 January 2002 04.44, Jason A.Van Cleve wrote:
Batch is specific to DOS/Windows.
prepare to be flamed by mainframe people :) Batch is a remnant from the old punch card days, when you'd load up a series of jobs consisting of a "batch of cards". The opposite would be online, and it's valid in the unix world as well //Anders
On Tue, 29 Jan 2002 04:44:20 +0100, Anders Johansson <andjoh@cicada.linux-site.net> wrote:
would be online, and it's valid in the unix world as well
I stand corrected as to the specificity of "batch". But is it considered proper among Linux programmers, or just mainframe people? ;) --Jason
participants (4)
-
Anders Johansson
-
Jason A.Van Cleve
-
Konstantin (Kastus) Shchuka
-
Mark A. Tagliaferro