[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: binfmt_script and ^M
From: |
Richard B. Johnson |
Subject: |
Re: binfmt_script and ^M |
Date: |
Mon, 5 Mar 2001 10:50:20 -0500 (EST) |
On Mon, 5 Mar 2001, John Kodis wrote:
> On Mon, Mar 05, 2001 at 08:40:22AM -0500, Richard B. Johnson wrote:
>
> > Somebody must have missed the boat entirely. Unix does not, never
> > has, and never will end a text line with '\r'.
>
> Unix does not, never has, and never will end a text line with ' ' (a
> space character) or with \t (a tab character). Yet if I begin a shell
> script with '#!/bin/sh ' or '#!/bin/sh\t', the training white space is
> striped and /bin/sh gets exec'd. Since \r has no special significance
> to Unix, I'd expect it to be treated the same as any other whitespace
> character -- it should be striped, and /bin/sh should get exec'd.
>
No. the '\n' character is interpreted. '\t' is expanded on stdout if
the terminal is "cooked". Other interpreted characters are:
^C, ^\, ^U, ^D, ^@, ^Q, ^S, ^Z, ^R, ^O, ^W, ^V
These are all upper-case ASCII letters codes minus 64. The erase (VERASE)
is special and is '?' + 64
The '\r' (^R) definitely has special significance to Unix. It's called
"VREPRINT", in the termios structure member "c_cc". If it exists in
a file instead of an output stream, these characters are not interpreted.
All files in Unix are binary. It's the 'C' runtime library that may
interpret file contents for programmer convenience. For instance,
fgets() reads until the new-line character. If you happen to have a
'\r' before that new-line, guess what? You will have a '\r' in your
string. If you were attempting to do:
ls foo\r
You will get a file-not found error unless you have a file with '\r'
as its last character.
There is really no such thing as "whitespace" in Unix compatible text.
For instance, the text in a Makefile MUST use the tab character as a
separator. Spaces won't do.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).
"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.
- Re: binfmt_script and ^M, (continued)
- Re: binfmt_script and ^M, Jeff Mcadams, 2001/03/05
- Re: binfmt_script and ^M, Paul Flinders, 2001/03/05
- Re: binfmt_script and ^M, Andreas Schwab, 2001/03/05
- Re: binfmt_script and ^M, Paul Flinders, 2001/03/05
- Re: binfmt_script and ^M, Paul Flinders, 2001/03/05
- Re: binfmt_script and ^M, Andreas Schwab, 2001/03/06
- Re: binfmt_script and ^M, Paul Flinders, 2001/03/06
- Re: binfmt_script and ^M, Pozsar Balazs, 2001/03/05
- Re: binfmt_script and ^M, Robert Read, 2001/03/05
- Re: binfmt_script and ^M, Richard B. Johnson, 2001/03/05
- Re: binfmt_script and ^M,
Richard B. Johnson <=
- Re: binfmt_script and ^M, Dr. Kelsey Hudson, 2001/03/05
- Re: binfmt_script and ^M, Peter Samuelson, 2001/03/06
- Re: binfmt_script and ^M, Dr. Kelsey Hudson, 2001/03/06
[PATCH]: print missing interpreter name [Was: Re: binfmt_script and ^M], Jan Nieuwenhuizen, 2001/03/05
Re: binfmt_script and ^M, Erik Hensema, 2001/03/05
Re: binfmt_script and ^M, Jesse Pollard, 2001/03/05