Escaping spaces in arguments to shell script

John Chambers jc at trillian.mit.edu
Sat Apr 29 10:24:32 EDT 2006


John Abreau wrote:
| Bill Ricker wrote:
| >  Unix open(2)
| > used to prevent you from creating files with ' ' or '/', but I fear it
| > only blocks '/' now ?
|
| When was this? Back when I first touched Unix, in 1983, the only bytes
| open(2) did not allow in filenames were '/' and '\000'. I've never seen
| a Unix where open(2) disallowed anything else.

Me too.  I'd be interested in hearing of  a  unix  where  the  open()
system  call  disallowed chars other tha '/' and NUL.  I've never run
across one (though I haven't thoroughly tested OSX, having been a bit
put off by its refusal to distinguish case in ASCII chars ;-)

I've occasionally seen this as a prime example  of  the  unix  design
principle  that  the  kernel should implement mechanisms, not policy.
Policy decisions more properly belong  outside  the  OS,  in  runtime
libraries.   This allows programmers to implement and experiment with
new policies without the well-known problems of futzing around inside
the  kernel.   And  it  lets  different  packages implement different
policies.  Right now, an important aspect of this is that  the  UTF-8
encoding can be done on any unixoid system without any kernel mods at
all.  This is because the kernel "doesn't care" about the encoding of
file names. Anything other than '/' and NUL is "just a char", and the
UTF-8 encoding doesn't use either  of  those  two  special  chars  in
multi-byte characters..


--
   _,
   O   John Chambers
 <:#/> <jc at trillian.mit.edu>
   +   <jc1742 at gmail.com>
  /#\  in Waltham, Massachusetts, USA, Earth
  | |
  ' `



More information about the Discuss mailing list