9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] So, do you space or not?
@ 2002-07-06 16:23 FJ Ballesteros
  2002-07-06 16:47 ` Sam
  2002-07-06 23:04 ` arisawa
  0 siblings, 2 replies; 5+ messages in thread
From: FJ Ballesteros @ 2002-07-06 16:23 UTC (permalink / raw)
  To: 9fans


Just to know it, do you want to

a) keep things as they are
b) remove quoting from ls et al, add it to those that print commands,
and
   fix those that don't cosider ' ' in file names.
c) forbid space and rename blanks in servers
d) Write poems
e) None of the above

Should you choose b or c, I may help.

PS: Bad answers may discount points from your average.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] So, do you space or not?
  2002-07-06 16:23 [9fans] So, do you space or not? FJ Ballesteros
@ 2002-07-06 16:47 ` Sam
  2002-07-06 23:04 ` arisawa
  1 sibling, 0 replies; 5+ messages in thread
From: Sam @ 2002-07-06 16:47 UTC (permalink / raw)
  To: 9fans

<warn>
Long winded e-mail follows.
</warn>

I've only just jumped onto this thread and since I didn't
want to repeat anything, I googled up the chain that started
this (back on may 30th!).  I may have missed part of it,
so if I'm restating anything or being terribly obvious,
forgive me.  Here's my 2 cents:

I've become familiar with quoted arguments as in my CLIs
the following is typical (where val is some value containing
spaces).

cli> set param 'val'

I have a little function that breaks up the line
into an argc & argv, similarly as I presume a shell
would.  Fairly simple, though I don't consider escape sequences
or single quotes inside of an arg.  I've been debating for
some time whether to modify the input read routine such that when
read in,

cli> set param0 'set param1 \'set param2 \'val\'\''

the args will look like this:
arg[0] == "set"
arg[1] == "param0"
arg[2] == "set param1 'set param2 \'val\''"

... essentially taking the outermost enclosed, escaped single quotes
and unescaping them.  It would obviously be fairly easy to do, but I've
yet to run into a use for it.  Also an avenue is unescaping all the
quotes, as usual.

I presume that option (b) in the replied to e-mail considers "fixing"
programs such that if you output shell commands that require args
containing spaces, we enclose the arg in quotes.  Easy enough with
%q.  Since ' is a printable character, though, we run into inclusion
problems ... right?  What happens when we want to name files by
ownership (ie: "Bob's file")?  Does %q escape all ' inside the string
it's enclosing? (online man page for print is still from 3E; no 4E
for me just yet)

If we're going to try changing these programs for this purpose, why
not introduce a new format that outputs the string with spaces
escaped?  The shell should handle this just fine, right?

ie (eg, z):

print("%z", "This is a file name");
results in:
This\ is\ a\ file\ name

There would be caveats with this as well (suppose we want to print
"this\ is\ a\ file\ name"), but is no more complex than the proposed
' solution.

It just doesn't seem like we've arrived at a decent solution yet.  Until
we find one, I'm going to have to vote a (or perhaps d, if no one has
tomatoes handy).

Am I way off?

Cheers,

Sam

On Sat, 6 Jul 2002, FJ Ballesteros wrote:

>
> Just to know it, do you want to
>
> a) keep things as they are
> b) remove quoting from ls et al, add it to those that print commands,
> and
>    fix those that don't cosider ' ' in file names.
> c) forbid space and rename blanks in servers
> d) Write poems
> e) None of the above
>
> Should you choose b or c, I may help.
>
> PS: Bad answers may discount points from your average.
>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] So, do you space or not?
  2002-07-06 16:23 [9fans] So, do you space or not? FJ Ballesteros
  2002-07-06 16:47 ` Sam
@ 2002-07-06 23:04 ` arisawa
  2002-07-06 23:24   ` arisawa
  1 sibling, 1 reply; 5+ messages in thread
From: arisawa @ 2002-07-06 23:04 UTC (permalink / raw)
  To: 9fans

I prefer to continue discussion along (b)

If a new command uq (unquote, and set ifs='\t' (tab)) is
offered and default field separator of awk, sort, etc are
set to the ifs, then we can do like the bellow:
ls -l|uq|awk '{print $10}'

Kenji Arisawa

>Just to know it, do you want to
>
>a) keep things as they are
>b) remove quoting from ls et al, add it to those that print  
commands,
>  and fix those that don't cosider ' ' in file names.
>c) forbid space and rename blanks in servers
>d) Write poems
>e) None of the above


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] So, do you space or not?
  2002-07-06 23:04 ` arisawa
@ 2002-07-06 23:24   ` arisawa
  0 siblings, 0 replies; 5+ messages in thread
From: arisawa @ 2002-07-06 23:24 UTC (permalink / raw)
  To: 9fans

>then we can do like the bellow:
>ls -l|uq|awk '{print $10}'
I should say: then the bellow may work

Kenji Arisawa


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] So, do you space or not?
@ 2002-07-08  9:04 Fco.J.Ballesteros
  0 siblings, 0 replies; 5+ messages in thread
From: Fco.J.Ballesteros @ 2002-07-08  9:04 UTC (permalink / raw)
  To: 9fans

I can't see the need for unquote.

Isn't it easier just not to use %q in ls and
run
	ls 
instead of 
	ls -l|uq|awk '{print $10}'

The rationale for q (quote) was that you still may
want to get the name quoted to print a command that
may be sent to rc, like in:

	echo rm `{q *.old}



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-07-08  9:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-06 16:23 [9fans] So, do you space or not? FJ Ballesteros
2002-07-06 16:47 ` Sam
2002-07-06 23:04 ` arisawa
2002-07-06 23:24   ` arisawa
2002-07-08  9:04 Fco.J.Ballesteros

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).