Re: putting escape characters in files

2001-05-13 Thread Greg McCarroll

* David H. Adler ([EMAIL PROTECTED]) wrote:
 On Fri, May 11, 2001 at 11:55:46AM +0100, Jonathan Peterson wrote:
  
  I see a topic far in the distance and rapidly dwindling...
 
 Topic?  What's a topic?
 

A London.pm thread topic is like a non-alchoholic ingredient in a cocktail, 
its only there so you can pretend not to be an inebriated addict. 


-- 
Greg McCarroll  http://www.mccarroll.uklinux.net



Re: putting escape characters in files

2001-05-12 Thread David H. Adler

On Fri, May 11, 2001 at 11:55:46AM +0100, Jonathan Peterson wrote:
 
 I see a topic far in the distance and rapidly dwindling...

Topic?  What's a topic?

:-)
-- 
David H. Adler - [EMAIL PROTECTED] - http://www.panix.com/~dha/
Six course banquet of nothing, with a scoop of sod-all for a palate
cleanser   - Rupert Giles



Re: putting escape characters in files

2001-05-11 Thread Dominic Mitchell

On Thu, May 10, 2001 at 10:25:00PM +0100, Nicholas Clark wrote:
 If your terminal has flow control enabled it will eat ^Q and ^S for you.
 stty -ixon
 removes this problem.

But then how do you pause that long ls listing when your
less,more,pg,sed,awkperl binaries are all fscked?  :-)

-Dom



Re: putting escape characters in files

2001-05-11 Thread Philip Newton

Dominic Mitchell wrote:
 On Thu, May 10, 2001 at 10:25:00PM +0100, Nicholas Clark wrote:
  If your terminal has flow control enabled it will eat ^Q 
  and ^S for you.
  stty -ixon
  removes this problem.
 
 But then how do you pause that long ls listing when your
 less,more,pg,sed,awkperl binaries are all fscked?  :-)

Use dd with the count= option for the first page, and with count= and skip=
for subsequent pages :)

Cheers,
Philip
-- 
Philip Newton [EMAIL PROTECTED]
All opinions are my own, not my employer's.
If you're not part of the solution, you're part of the precipitate.



Re: putting escape characters in files

2001-05-11 Thread Dominic Mitchell

On Fri, May 11, 2001 at 11:10:13AM +0200, Philip Newton wrote:
 Dominic Mitchell wrote:
  On Thu, May 10, 2001 at 10:25:00PM +0100, Nicholas Clark wrote:
   If your terminal has flow control enabled it will eat ^Q 
   and ^S for you.
   stty -ixon
   removes this problem.
  
  But then how do you pause that long ls listing when your
  less,more,pg,sed,awkperl binaries are all fscked?  :-)
 
 Use dd with the count= option for the first page, and with count= and skip=
 for subsequent pages :)

You're right, but assuming you can get into a bourne shell, you can
still do things like write cat(1) in sh, as well.  Although it'd be hard
to control without ^S and ^Q, unless you have a modern /bin/sh with the
arithmetic stuff to count lines with.  Otherwise you'd have to use
expr(1), which is also probably busted.

We now return you to your regularly scheduled comp.unix.buffy debate...

-Dom



Re: putting escape characters in files

2001-05-11 Thread Dave Hodgkinson

Dominic Mitchell [EMAIL PROTECTED] writes:

 On Thu, May 10, 2001 at 10:25:00PM +0100, Nicholas Clark wrote:
  If your terminal has flow control enabled it will eat ^Q and ^S for you.
  stty -ixon
  removes this problem.
 
 But then how do you pause that long ls listing when your
 less,more,pg,sed,awkperl binaries are all fscked?  :-)

Stallman used to have a long rant about ^S/^Q that shipped with
the emacs source. Wonder if it's still there.

-- 
Dave Hodgkinson, http://www.hodgkinson.org
Editor-in-chief, The Highway Star   http://www.deep-purple.com
  Interim CTO, web server farms, technical strategy
   



Re: putting escape characters in files

2001-05-11 Thread Philip Newton

Dominic Mitchell wrote:
 assuming you can get into a bourne shell, you can
 still do things like write cat(1) in sh, as well.

This is not going to help you pause output.

 Although it'd be hard to control without ^S and ^Q,

...which was what the original post was all about.

Cheers,
Philip
-- 
Philip Newton [EMAIL PROTECTED]
All opinions are my own, not my employer's.
If you're not part of the solution, you're part of the precipitate.



Re: putting escape characters in files

2001-05-11 Thread Peter Haworth

On Thu, 10 May 2001 22:25:00 +0100, Nicholas Clark wrote:
 (Someone has a quote about the only safe thing to send down a serial line
 being a break, because emacs interprets every character)

You mean this?
On a normal ascii line, the only safe condition to detect is a 'BREAK'
 - everything else having been assigned functions by Gnu EMACS.
-- Tarl Neustaedter

I find that having an enormous sig file is extremely useful on occasions like this.

-- 
Peter Haworth   [EMAIL PROTECTED]
The network had broken because someone had snipped out
 40 cm of cable, apparently to tie something together.
-- Alex McLean



Re: putting escape characters in files

2001-05-11 Thread Dominic Mitchell

On Fri, May 11, 2001 at 11:41:20AM +0200, Philip Newton wrote:
 Dominic Mitchell wrote:
  assuming you can get into a bourne shell, you can
  still do things like write cat(1) in sh, as well.
 
 This is not going to help you pause output.
 
  Although it'd be hard to control without ^S and ^Q,
 
 ...which was what the original post was all about.

No, you'd need the maths operators that came with later shells, so you
could work out lines.  Dammit, I'm going to have to write shmore now.

#!/bin/sh
lineno=1
while read line
do
echo $line
lineno=$((lineno+1))
if [ $(($lineno % 24)) = 0 ] ; then
echo -n  -- more -- 
read ans /dev/tty
test $ans = q  exit 0
fi
done

-Dom



Re: putting escape characters in files

2001-05-11 Thread Matthew Byng-Maddick

On Fri, 11 May 2001, Dominic Mitchell wrote:
 On Fri, May 11, 2001 at 11:41:20AM +0200, Philip Newton wrote:
  Dominic Mitchell wrote:
   assuming you can get into a bourne shell, you can
   still do things like write cat(1) in sh, as well.
  This is not going to help you pause output.
   Although it'd be hard to control without ^S and ^Q,
  ...which was what the original post was all about.
 No, you'd need the maths operators that came with later shells, so you
 could work out lines.  Dammit, I'm going to have to write shmore now.
 #!/bin/sh
 lineno=1
 while read line
 do
   echo $line
   lineno=$((lineno+1))
   if [ $(($lineno % 24)) = 0 ] ; then
   echo -n  -- more -- 
   read ans /dev/tty
   test $ans = q  exit 0
   fi
 done

That breaks if the line is longer than the width of your screen.

MBM

-- 
Matthew Byng-Maddick  [EMAIL PROTECTED] +44 20  8980 5714  (Home)
http://colondot.net/ +44 7956 613942  (Mobile)
Under  any conditions,  anywhere,  whatever you  are doing,  there is some
ordinance under which you can be booked.  -- Robert D. Sprecht, Rand Corp.




Re: putting escape characters in files

2001-05-11 Thread Dominic Mitchell

On Fri, May 11, 2001 at 11:14:08AM +0100, Matthew Byng-Maddick wrote:
 On Fri, 11 May 2001, Dominic Mitchell wrote:
  On Fri, May 11, 2001 at 11:41:20AM +0200, Philip Newton wrote:
   Dominic Mitchell wrote:
assuming you can get into a bourne shell, you can
still do things like write cat(1) in sh, as well.
   This is not going to help you pause output.
Although it'd be hard to control without ^S and ^Q,
   ...which was what the original post was all about.
  No, you'd need the maths operators that came with later shells, so you
  could work out lines.  Dammit, I'm going to have to write shmore now.
  #!/bin/sh
  lineno=1
  while read line
  do
  echo $line
  lineno=$((lineno+1))
  if [ $(($lineno % 24)) = 0 ] ; then
  echo -n  -- more -- 
  read ans /dev/tty
  test $ans = q  exit 0
  fi
  done
 
 That breaks if the line is longer than the width of your screen.

Oh dear.

-Dom



Re: putting escape characters in files

2001-05-11 Thread Philip Newton

Matthew Byng-Maddick wrote:
 That breaks if the line is longer than the width of your screen.

So do a lot of cheap pager routines.

Cheers,
Philip
-- 
Philip Newton [EMAIL PROTECTED]
All opinions are my own, not my employer's.
If you're not part of the solution, you're part of the precipitate.



Re: putting escape characters in files

2001-05-11 Thread Jonathan Peterson

At 10:32 11/05/01 +0100, you wrote:
Dominic Mitchell [EMAIL PROTECTED] writes:

  On Thu, May 10, 2001 at 10:25:00PM +0100, Nicholas Clark wrote:
   If your terminal has flow control enabled it will eat ^Q and ^S for you.
   stty -ixon
   removes this problem.
 
  But then how do you pause that long ls listing when your
  less,more,pg,sed,awkperl binaries are all fscked?  :-)

Stallman used to have a long rant about ^S/^Q that shipped with
the emacs source. Wonder if it's still there.

You know, from the outside, Unix looks so well designed and clean and modern...


-- 
Jonathan Peterson
Technical Manager, Unified Ltd, 020 7383 6092
[EMAIL PROTECTED]




Re: putting escape characters in files

2001-05-11 Thread Roger Burton West

On or about Fri, May 11, 2001 at 10:48:41AM +0100, Jonathan Peterson typed:

You know, from the outside, Unix looks so well designed and clean and modern...

From the outside, Windows looks as if it works.

ObRant: computers and OSes in their current state are not consumer devices.
They're not sufficiently reliable or intuitive. Bad marketing has made
people think they need the things; most of them are wrong...

Roger



Re: putting escape characters in files

2001-05-11 Thread Struan Donald

* at 11/05 11:32 +0100 Roger Burton West said:
 On or about Fri, May 11, 2001 at 10:48:41AM +0100, Jonathan Peterson typed:
 
 You know, from the outside, Unix looks so well designed and clean and modern...
 
 From the outside, Windows looks as if it works.
 
 ObRant: computers and OSes in their current state are not consumer devices.
 They're not sufficiently reliable or intuitive. Bad marketing has made
 people think they need the things; most of them are wrong...

you just have to see that people have trouble with palm's sometimes
and they are so much more simple to realise that your average fully
fledged computer in not a consumer device.

but then any reasonably flexible multi-purpose device is always going
to have a hard time being a consumer device as by it's nature it's
complex and trying to make complex things appear simple is very very
hard.

OTOH, if it was simple it's be no fun :) [1]

struan

[1] usual caveats regarding definition of fun apply



Re: putting escape characters in files

2001-05-11 Thread Dave Hodgkinson

Roger Burton West [EMAIL PROTECTED] writes:

 ObRant: computers and OSes in their current state are not consumer devices.
 They're not sufficiently reliable or intuitive. Bad marketing has made
 people think they need the things; most of them are wrong...

OK, so what does it take?

For me, the sorts of things that I _think_ IPv6 has should go a long
way. Ubiquitous encryption and authentication will breed the real next
generation of applicances. Or something.

-- 
Dave Hodgkinson, http://www.hodgkinson.org
Editor-in-chief, The Highway Star   http://www.deep-purple.com
  Interim CTO, web server farms, technical strategy
   



Re: putting escape characters in files

2001-05-11 Thread Roger Burton West

On or about Fri, May 11, 2001 at 11:37:20AM +0100, Struan Donald typed:

but then any reasonably flexible multi-purpose device is always going
to have a hard time being a consumer device as by it's nature it's
complex and trying to make complex things appear simple is very very
hard.

Yes.

Things like the Amstrad word-processor are what people really want.
(Just ask any secretary who was forced to upgrade from one to a PC.)

R



Re: putting escape characters in files

2001-05-11 Thread Roger Burton West

On or about Fri, May 11, 2001 at 11:32:33AM +0100, Dave Hodgkinson typed:
Roger Burton West [EMAIL PROTECTED] writes:
 ObRant: computers and OSes in their current state are not consumer devices.
 They're not sufficiently reliable or intuitive. Bad marketing has made
 people think they need the things; most of them are wrong...
OK, so what does it take?

While using a computer is a skill considered harder than using a
washing machine or mowing a lawn, they're not ready.

Putting pretty interfaces on existing unstable systems does not
help to make them simpler...

R



Re: putting escape characters in files

2001-05-11 Thread Jonathan Peterson

At 11:37 11/05/01 +0100, you wrote:

but then any reasonably flexible multi-purpose device is always going
to have a hard time being a consumer device as by it's nature it's
complex and trying to make complex things appear simple is very very
hard.


I can never work out if life is getting simpler or more complex. Computers 
seem very complex, and an application (lets say, a spreadsheet) appears to 
have thousands of features and whatnot that make the business of creating a 
Profit/Loss sheet far more complex than it ever was (or by implication 
ought to be).

But this replaced a system of copybooks, ledgers, accounting systems and 
procedures that was also very complex. Not only that, but all the actual 
arithmetic had to be done (by the human) as well. So the accountant of 1890 
needed to do mental arithmetic very fast and accurately (and in L.S.D.), 
and had to know and understand a bookshelf full of different ledgers, each 
with different columns, tables and and systems. And they had to work with 
near 100% accuracy, because of the difficulty of erasing or re-doing work.

I think the difference is not that computers (or cars, or whatever) are 
that much more complex than what went before them. The difference is:

1. People are expected to understand and deal with all these things, not to 
specialise in one. Today, we are expected to be able to drive a car and use 
a spreadsheet, and then paint the spare room. The Victorian accountant most 
likely would not have known how to ride, certainly not have known how to 
look after a horse. They would not have done their own cooking, even, would 
not be responsible for repairing or even organising repairs to their rented 
accomodation, etc etc.

2. The rate of change is very fast. The Victorian's system of accountancy, 
while more complex, would have been what he grew up with, and would not 
have changed radically over his life (assuming he retired prior to the 
1940's).

Jon

I see a topic far in the distance and rapidly dwindling...
-- 
Jonathan Peterson
Technical Manager, Unified Ltd, 020 7383 6092
[EMAIL PROTECTED]




Re: putting escape characters in files

2001-05-11 Thread Dave Hodgkinson

Roger Burton West [EMAIL PROTECTED] writes:

 Putting pretty interfaces on existing unstable systems does not
 help to make them simpler...

That's part of it. Landing a thudding great book of what the thing
_can_ do, rather than a cookbook of what you _want_ it to do is very
offputting.

There's a computer version of the Poke'mon card game that leads you
through learning the rules very gently and very well. That's the sort
of thing we need for gadgets...start off with stop and play and
then gently lead you through to the hard stuff.

Or make it like the Tivo - it just works.

-- 
Dave Hodgkinson, http://www.hodgkinson.org
Editor-in-chief, The Highway Star   http://www.deep-purple.com
  Interim CTO, web server farms, technical strategy
   



Re: putting escape characters in files

2001-05-11 Thread Struan Donald

* at 11/05 11:49 +0100 Dave Hodgkinson said:
 Roger Burton West [EMAIL PROTECTED] writes:
 
  Putting pretty interfaces on existing unstable systems does not
  help to make them simpler...
 
 That's part of it. Landing a thudding great book of what the thing
 _can_ do, rather than a cookbook of what you _want_ it to do is very
 offputting.

but then what you want to do differs greatly for different people so
instead of one book with lots of information you have to sift through
you get lots of books you have to sift through to find the right one.
I imagine most computer neophytes find their first visit to the
computer section of any large bookshop pretty damn confusing to start
with. 

plus you're assuming people know what they want to do, or even what
they can do. The fact that you could have _two_ windows open at once
was a revelation to a friends dad recently. 

There is a very real argument for devices that do one thing and one
thing only but do it in a very simple way without all the flimflam
that accompanies most modern computers. Donald Norman has quite a few
good books on this.

 Or make it like the Tivo - it just works.

which is kind of a proof of the one thing very well point.

struan



Re: putting escape characters in files

2001-05-11 Thread Dave Hodgkinson

Struan Donald [EMAIL PROTECTED] writes:

 There is a very real argument for devices that do one thing and one
 thing only but do it in a very simple way without all the flimflam
 that accompanies most modern computers. Donald Norman has quite a few
 good books on this.

Agreed, but they MUST talk to each other. Securely and knowingly.

-- 
Dave Hodgkinson, http://www.hodgkinson.org
Editor-in-chief, The Highway Star   http://www.deep-purple.com
  Interim CTO, web server farms, technical strategy
   



Re: putting escape characters in files

2001-05-11 Thread Struan Donald

* at 11/05 12:07 +0100 Dave Hodgkinson said:
 Struan Donald [EMAIL PROTECTED] writes:
 
  There is a very real argument for devices that do one thing and one
  thing only but do it in a very simple way without all the flimflam
  that accompanies most modern computers. Donald Norman has quite a few
  good books on this.
 
 Agreed, but they MUST talk to each other. Securely and knowingly.

see Donald Norman. he talks about all this stuff.

struan



Re: putting escape characters in files

2001-05-11 Thread Chris Devers

At 10:05 AM 2001.05.11 +0100, Dominic Mitchell wrote:
On Thu, May 10, 2001 at 10:25:00PM +0100, Nicholas Clark wrote:
 If your terminal has flow control enabled it will eat ^Q and ^S
 for you. stty -ixon removes this problem.

But then how do you pause that long ls listing when your
less,more,pg,sed,awkperl binaries are all fscked?  :-)

How about piping to lp then?
Load up enough paper and you can pause as long as you'd like...
;)



--
Chris Devers [EMAIL PROTECTED]




Re: putting escape characters in files

2001-05-11 Thread Martin Ling

On Fri, May 11, 2001 at 11:32:15AM +0100, Roger Burton West wrote:
 
 ObRant: computers and OSes in their current state are not consumer devices.

ObRantContinuation:

It goes a little further than that. Cars are now consumer devices; but
if you were deploying a fleet of new company vans, you wouldn't expect
the random office guy who'd read a dummies book to maintain them - you'd
hire a mechanic.


Martin



Re: putting escape characters in files

2001-05-11 Thread Jonathan Peterson

At 15:42 11/05/01 +0100, you wrote:

It goes a little further than that. Cars are now consumer devices; but
if you were deploying a fleet of new company vans, you wouldn't expect
the random office guy who'd read a dummies book to maintain them - you'd
hire a mechanic.


Hmmm.. You're suggesting that the mechanic is a well trained engineer who 
knows all about cars, while companies are trying to get away with using 
pimply faced youths who've just read a book or got an MCP to maintain 
computers on the cheap. Your average mechanic follows instructions on a 
computer that tells him what part number to use to replace the faulty item. 
The act of replacing simply involves known what size socket wrench to use, 
and remembering where to attach the wires and hoses afterwards.

The average bottom rung mechanic knows as much about cars as the average 
bottom rung tech support guy knows about computers.

The difference is that the mechanic can't get a job without his NVQ, 
whereas the PFY can get a job without his MCP.


-- 
Jonathan Peterson
Technical Manager, Unified Ltd, 020 7383 6092
[EMAIL PROTECTED]




Re: putting escape characters in files

2001-05-11 Thread Martin Ling

On Fri, May 11, 2001 at 04:05:21PM +0100, Jonathan Peterson wrote:
 
 The average bottom rung mechanic knows as much about cars as the average 
 bottom rung tech support guy knows about computers.

Okay. I know very little of the vehicle maintenance industry, so it was
a poor choice of analogy, but I hold to the rough point - there are too
many organisations (notably schools, as well as companies) pushing
excessive technical responsibilities onto unqualified and inexperienced
staff.  It's not fair on (a) the staff, (b) the rest of the organisation
(c) others affected through poor security (private/personal information
leakage, network abuse...)

...and arguably

(d) unemployed BOFHs.


Martin



Re: putting escape characters in files

2001-05-11 Thread Jonathan Peterson

At 16:31 11/05/01 +0100, you wrote:
there are too
many organisations (notably schools, as well as companies) pushing
excessive technical responsibilities onto unqualified and inexperienced
staff.

That's actually a really good point (about the schools). You hear about all 
these 'computers for schools' initiatives, but very rarely do you hear 
about 'CS teachers for schools'. It usually means that some maths teach 
somewhere gets another 2 lessons per week and a small LAN to look after.



Martin

-- 
Jonathan Peterson
Technical Manager, Unified Ltd, 020 7383 6092
[EMAIL PROTECTED]




Re: putting escape characters in files

2001-05-11 Thread Chris Benson

On Fri, May 11, 2001 at 11:14:08AM +0100, Matthew Byng-Maddick wrote:
 On Fri, 11 May 2001, Dominic Mitchell wrote:
  On Fri, May 11, 2001 at 11:41:20AM +0200, Philip Newton wrote:
   Dominic Mitchell wrote:
assuming you can get into a bourne shell, you can
still do things like write cat(1) in sh, as well.
   This is not going to help you pause output.
Although it'd be hard to control without ^S and ^Q,
   ...which was what the original post was all about.
  No, you'd need the maths operators that came with later shells, so you
  could work out lines.  Dammit, I'm going to have to write shmore now.
  #!/bin/sh
  lineno=1
  while read line
  do
  lineno=$((lineno+1))
  if [ $(($lineno % 24)) = 0 ] ; then
  echo -n  -- more -- 
  read ans /dev/tty
  test $ans = q  exit 0
  fi
  done
 
 That breaks if the line is longer than the width of your screen.

   echo $line
---
   echo `echo $line | dd bs=79 count=1 2/dev/null`

-- 
Chris Benson
P.S. Why are we doing this in sh(1)??



Re: putting escape characters in files

2001-05-10 Thread Dominic Mitchell

On Thu, May 10, 2001 at 04:35:29PM +0100, Struan Donald wrote:
 kind of off topic but how do you get things like ^M and such like into
 a file for, say, writing vi macros?
 
 i've had a look through some docs but i'm beggining to suspect it's
 one of those bit of unix aracana know to a chosen few. or is there
 some site/resource that contains this info?

Generally you can enter a control character into vi and most Unix shells
by pressing ^V and then the character you want.

In Emacs, it's ^Q, then the character you want.

-Dom



Re: putting escape characters in files

2001-05-10 Thread Roger Burton West

On or about Thu, May 10, 2001 at 04:35:29PM +0100, Struan Donald typed:
kind of off topic but how do you get things like ^M and such like into
a file for, say, writing vi macros?

ctrl-x 0 d

but using it in a search/replace pattern is harder.

Roger



Re: putting escape characters in files

2001-05-10 Thread Struan Donald

* at 10/05 16:37 +0100 Dominic Mitchell said:
 On Thu, May 10, 2001 at 04:35:29PM +0100, Struan Donald wrote:
  kind of off topic but how do you get things like ^M and such like into
  a file for, say, writing vi macros?
  
  i've had a look through some docs but i'm beggining to suspect it's
  one of those bit of unix aracana know to a chosen few. or is there
  some site/resource that contains this info?
 
 Generally you can enter a control character into vi and most Unix shells
 by pressing ^V and then the character you want.

ah, thanks
 
 In Emacs, it's ^Q, then the character you want.

only ^Q? that's not like emacs :)

struan



Re: putting escape characters in files

2001-05-10 Thread Robin Houston

On Thu, May 10, 2001 at 04:35:29PM +0100, Struan Donald wrote:
 kind of off topic but how do you get things like ^M and such like into
 a file for, say, writing vi macros?

perl -e 'print \cM'  my-file

;-)
 .robin.


ps. Dominic's already given a proper answer...

-- 
Flee to me, remote elf!



Re: putting escape characters in files

2001-05-10 Thread Dominic Mitchell

On Thu, May 10, 2001 at 04:44:41PM +0100, Struan Donald wrote:
  In Emacs, it's ^Q, then the character you want.
 
 only ^Q? that's not like emacs :)

Well, it's assuming that nobody's fiddled with the keymaps.  You could
alternatively do:

M-x quoted-insert RET RET

-Dom



Re: putting escape characters in files

2001-05-10 Thread Nicholas Clark

On Thu, May 10, 2001 at 04:44:41PM +0100, Struan Donald wrote:
 * at 10/05 16:37 +0100 Dominic Mitchell said:

  Generally you can enter a control character into vi and most Unix shells
  by pressing ^V and then the character you want.
 
 ah, thanks
  
  In Emacs, it's ^Q, then the character you want.
 
 only ^Q? that's not like emacs :)

If your terminal has flow control enabled it will eat ^Q and ^S for you.
stty -ixon
removes this problem.
(Someone has a quote about the only safe thing to send down a serial line
being a break, because emacs interprets every character)

Nicholas Clark