Scripts kai CR-LF

Giorgos Keramidas keramida at ceid.upatras.gr
Mon Oct 3 18:41:06 EEST 2005


On 2005-10-03 18:16, Antonios Christofides <anthony at itia.ntua.gr> wrote:
> anthony at voltaire:/var/tmp$ cat >hello
> #!/bin/bash
> echo 'Hello, world!'
> anthony at voltaire:/var/tmp$ chmod 755 hello
> anthony at voltaire:/var/tmp$ ./hello
> Hello, world!
> anthony at voltaire:/var/tmp$ unix2dos hello
> anthony at voltaire:/var/tmp$ ./hello
> : bad interpreter: No such file or directory
>
> Το carriage return δεν είναι white space; Το man isspace λέει πως
> είναι, τουλάχιστον σε locales C και POSIX (και τα παραπάνω τα δοκίμασα
> σε POSIX).

Μάλλον δεν είναι...

Το SUSv3 λέει για τον όρο "carriage return"[1]:

	3.86 Carriage-Return Character (<carriage-return>)

	A character that in the output stream indicates that printing
	should start at the beginning of the same physical line in which
	the <carriage-return> occurred. It is the character designated
	by '\r' in the C language. It is unspecified whether this
	character is the exact sequence transmitted to an output device
	by the system to accomplish the movement to the beginning of the
	line.

Ο τρόπος με τον οποίο δουλεύουν τα "command language interpreters"[2]
δεν ξεκαθαρίζει αν το CR είναι valid στο τέλος της γραμμής και θεωρείται
whitespace ή μέρος από το όνομα / command-line του intepreter.

[1] http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_86

[2] http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_105




More information about the Linux-greek-users mailing list