zsh-users
 help / color / mirror / code / Atom feed
* Vanishing files ?
@ 2006-05-28 15:24 Meino Christian Cramer
  2006-05-28 18:32 ` Bart Schaefer
  2006-05-28 18:37 ` Vanishing files ? DervishD
  0 siblings, 2 replies; 15+ messages in thread
From: Meino Christian Cramer @ 2006-05-28 15:24 UTC (permalink / raw)
  To: zsh-users

Hi,

 got a mysterious (at least for me) effect:

        Script started on Sun May 28 17:14:22 2006
        solfire:/home/mccramer>ls -l /bin/zsh
        rwxr-xr-x 2 root root 754456 Mar 28 18:32 /bin/zsh
        solfire:/home/mccramer>cat ~/bin/tempwatch
        #!/bin/zsh
        while true
        do
            sensors
            sleep 10
        done | grep 'CPU Temp'
        
        solfire:/home/mccramer>~/bin/tempwatch
 ???>>> zsh: no such file or directory: /home/mccramer/bin/tempwatch
        solfire:/home/mccramer>while true
        while> do
        while> sensors
        while> sleep 10
        while> done | grep 'CPU Temp'
        CPU Temp:  +45.5 C  (high =   +80 C, hyst =   +75 C)   sensor = thermistor
        CPU Temp:  +46.5 C  (high =   +80 C, hyst =   +75 C)   sensor = thermistor
        
        solfire:/home/mccramer>
        
        Script done on Sun May 28 17:15:52 2006

 Why can I execute the contents of the script "tempwatch" but not the
 script itsself?

 By the way: Does anyone know a trick how to remove _all_
 Escape-Sequences from a script generated by the command "script" ...
 "col -b" does not catch all.

 Keep hacking!
 Meino


 


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

* Re: Vanishing files ?
  2006-05-28 15:24 Vanishing files ? Meino Christian Cramer
@ 2006-05-28 18:32 ` Bart Schaefer
  2006-05-28 18:38   ` Meino Christian Cramer
  2006-05-29  7:57   ` Anssi Saari
  2006-05-28 18:37 ` Vanishing files ? DervishD
  1 sibling, 2 replies; 15+ messages in thread
From: Bart Schaefer @ 2006-05-28 18:32 UTC (permalink / raw)
  To: zsh-users

On May 28,  5:24pm, Meino Christian Cramer wrote:
}
}  Why can I execute the contents of the script "tempwatch" but not the
}  script itsself?

That usually means that the program named in the #! line is not where
the path in that line says it is.

Have you checked that you're not, for example, attempting to execute
a program named "/bin/zsh^M" (where ^M is a carriage return)?  Or some
other stray character you can't see at the end of the line?  I assume
zsh really is in /bin/.

}  By the way: Does anyone know a trick how to remove _all_
}  Escape-Sequences from a script generated by the command "script" ...

	sed "s/[^"$'\t '"-~]//g"

The order of tab and space in $'\t ' is important.  The above actually
strips anything that's not printable ASCII, so if you're using an ISO
character set you probably need to put more stuff inside the [ ].


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

* Re: Vanishing files ?
  2006-05-28 15:24 Vanishing files ? Meino Christian Cramer
  2006-05-28 18:32 ` Bart Schaefer
@ 2006-05-28 18:37 ` DervishD
  2006-05-28 18:44   ` Meino Christian Cramer
  1 sibling, 1 reply; 15+ messages in thread
From: DervishD @ 2006-05-28 18:37 UTC (permalink / raw)
  To: Meino Christian Cramer; +Cc: zsh-users

    Hi Meino :)

 * Meino Christian Cramer <Meino.Cramer@gmx.de> dixit:
>  Why can I execute the contents of the script "tempwatch" but not the
>  script itsself?

    Probably because you don't have read or execute permissions for
the script :?? You can execute the contents because you're entering
them in the command line, but that has nothing to do with the
problem you have.
 
>  By the way: Does anyone know a trick how to remove _all_
>  Escape-Sequences from a script generated by the command "script" ...
>  "col -b" does not catch all.

    "sed". Or Perl, if you know Perl but don't know sed. It's tricky,
anyway, because not all escape sequences have the same length :((

    Probably there is a much clever trick to achieve what you want,
but I'm not aware of it, sorry :(((

    Good luck!

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to... RAmen!


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

* Re: Vanishing files ?
  2006-05-28 18:32 ` Bart Schaefer
@ 2006-05-28 18:38   ` Meino Christian Cramer
  2006-05-28 23:24     ` Bart Schaefer
  2006-05-29  7:57   ` Anssi Saari
  1 sibling, 1 reply; 15+ messages in thread
From: Meino Christian Cramer @ 2006-05-28 18:38 UTC (permalink / raw)
  To: schaefer; +Cc: zsh-users

From: Bart Schaefer <schaefer@brasslantern.com>
Subject: Re: Vanishing files ?
Date: Sun, 28 May 2006 11:32:00 -0700

> On May 28,  5:24pm, Meino Christian Cramer wrote:
> }
> }  Why can I execute the contents of the script "tempwatch" but not the
> }  script itsself?
> 
> That usually means that the program named in the #! line is not where
> the path in that line says it is.
> 
> Have you checked that you're not, for example, attempting to execute
> a program named "/bin/zsh^M" (where ^M is a carriage return)?  Or some
> other stray character you can't see at the end of the line?  I assume
> zsh really is in /bin/.

  I did:
  solfire:/home/mccramer>ls -l /bin/zsh
  -rwxr-xr-x 2 root root 754456 Mar 28 18:32 /bin/zsh
  solfire:/home/mccramer>

  and it is no problem for me to execute /bin/zsh from the commandline
  -- just getting another shell.

  With vim I loaded the script in question and did a 
  "set list", which displays anything, which normally is suppressed.
  After the "h" of "#!/bin/zsh" there is only a "$", meaning that
  this is the end of line.

  Same results with another editor (Microemacs).

  Are there any other "bad invisible things", which may cause this
  effect ?

  Kepp hacking!
  Meino





> }  By the way: Does anyone know a trick how to remove _all_
> }  Escape-Sequences from a script generated by the command "script" ...
> 
> 	sed "s/[^"$'\t '"-~]//g"
> 
> The order of tab and space in $'\t ' is important.  The above actually
> strips anything that's not printable ASCII, so if you're using an ISO
> character set you probably need to put more stuff inside the [ ].
> 


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

* Re: Vanishing files ?
  2006-05-28 18:37 ` Vanishing files ? DervishD
@ 2006-05-28 18:44   ` Meino Christian Cramer
  2006-05-29  6:11     ` DervishD
  0 siblings, 1 reply; 15+ messages in thread
From: Meino Christian Cramer @ 2006-05-28 18:44 UTC (permalink / raw)
  To: zsh; +Cc: zsh-users

From: DervishD <zsh@dervishd.net>
Subject: Re: Vanishing files ?
Date: Sun, 28 May 2006 20:37:24 +0200

Hi Raúl,



>     Hi Meino :)
> 
>  * Meino Christian Cramer <Meino.Cramer@gmx.de> dixit:
> >  Why can I execute the contents of the script "tempwatch" but not the
> >  script itsself?
> 
>     Probably because you don't have read or execute permissions for
> the script :?? You can execute the contents because you're entering
> them in the command line, but that has nothing to do with the
> problem you have.


  Hmmm...I did a 

    solfire:/home/mccramer>ls -l  bin/tmepwatch
    -rwxr-xr-x 1 mccramer users 79 May 28 20:36 bin/tmepwatch
    solfire:/home/mccramer>

 and it seems to be an X-file ;)


 Keep hacking!
 Meino
 

  
> >  By the way: Does anyone know a trick how to remove _all_
> >  Escape-Sequences from a script generated by the command "script" ...
> >  "col -b" does not catch all.
> 
>     "sed". Or Perl, if you know Perl but don't know sed. It's tricky,
> anyway, because not all escape sequences have the same length :((
> 
>     Probably there is a much clever trick to achieve what you want,
> but I'm not aware of it, sorry :(((
> 
>     Good luck!
> 
>     Raúl Núñez de Arenas Coronado

> -- 
> Linux Registered User 88736 | http://www.dervishd.net
> http://www.pleyades.net & http://www.gotesdelluna.net
> It's my PC and I'll cry if I want to... RAmen!
> 

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

* Re: Vanishing files ?
  2006-05-28 18:38   ` Meino Christian Cramer
@ 2006-05-28 23:24     ` Bart Schaefer
  2006-05-29  2:38       ` Meino Christian Cramer
  0 siblings, 1 reply; 15+ messages in thread
From: Bart Schaefer @ 2006-05-28 23:24 UTC (permalink / raw)
  To: zsh-users

On May 28,  8:38pm, Meino Christian Cramer wrote:
}
} > Have you checked that you're not, for example, attempting to execute
} > a program named "/bin/zsh^M" (where ^M is a carriage return)?
} 
}   With vim I loaded the script in question and did a 
}   "set list", which displays anything, which normally is suppressed.
}   After the "h" of "#!/bin/zsh" there is only a "$", meaning that
}   this is the end of line.

That's not necessarily an accurate test.  If the "fileformats" option in
vim includes the word "dos", then it will treat "\r\n" as end of line and
hide the ^M from you, even with "set list".

}   Same results with another editor (Microemacs).

I don't know anything about Microemacs specifically, but most Emacs
variants also are "smart" about automatically handling line endings.

Try "cat -v" on the script.


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

* Re: Vanishing files ?
  2006-05-28 23:24     ` Bart Schaefer
@ 2006-05-29  2:38       ` Meino Christian Cramer
  0 siblings, 0 replies; 15+ messages in thread
From: Meino Christian Cramer @ 2006-05-29  2:38 UTC (permalink / raw)
  To: schaefer; +Cc: zsh-users

From: Bart Schaefer <schaefer@brasslantern.com>
Subject: Re: Vanishing files ?
Date: Sun, 28 May 2006 16:24:31 -0700

> On May 28,  8:38pm, Meino Christian Cramer wrote:
> }
> } > Have you checked that you're not, for example, attempting to execute
> } > a program named "/bin/zsh^M" (where ^M is a carriage return)?
> } 
> }   With vim I loaded the script in question and did a 
> }   "set list", which displays anything, which normally is suppressed.
> }   After the "h" of "#!/bin/zsh" there is only a "$", meaning that
> }   this is the end of line.
> 
> That's not necessarily an accurate test.  If the "fileformats" option in
> vim includes the word "dos", then it will treat "\r\n" as end of line and
> hide the ^M from you, even with "set list".
> 
> }   Same results with another editor (Microemacs).
> 
> I don't know anything about Microemacs specifically, but most Emacs
> variants also are "smart" about automatically handling line endings.
> 
> Try "cat -v" on the script.
> 

THAT's it !!!
Thanks a lot, one nightmare less ! :)

Keep hacking!
Meino


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

* Re: Vanishing files ?
  2006-05-28 18:44   ` Meino Christian Cramer
@ 2006-05-29  6:11     ` DervishD
  2006-05-29  8:56       ` Meino Christian Cramer
  0 siblings, 1 reply; 15+ messages in thread
From: DervishD @ 2006-05-29  6:11 UTC (permalink / raw)
  To: Meino Christian Cramer; +Cc: zsh-users

    Hi Meino :)

 * Meino Christian Cramer <Meino.Cramer@gmx.de> dixit:
> >  * Meino Christian Cramer <Meino.Cramer@gmx.de> dixit:
> > >  Why can I execute the contents of the script "tempwatch" but not the
> > >  script itsself?
> > 
> >     Probably because you don't have read or execute permissions for
> > the script :?? You can execute the contents because you're entering
> > them in the command line, but that has nothing to do with the
> > problem you have.
> 
> 
>   Hmmm...I did a 
> 
>     solfire:/home/mccramer>ls -l  bin/tmepwatch
>     -rwxr-xr-x 1 mccramer users 79 May 28 20:36 bin/tmepwatch
>     solfire:/home/mccramer>
> 
>  and it seems to be an X-file ;)

    It is!. Well, then the problem is probably that the first line of
the script doesn't contain a valid interpreter. Could you please post
the first line of bin/tmepwatch?

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to... RAmen!


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

* Re: Vanishing files ?
  2006-05-28 18:32 ` Bart Schaefer
  2006-05-28 18:38   ` Meino Christian Cramer
@ 2006-05-29  7:57   ` Anssi Saari
  2006-05-29 15:32     ` Peter Stephenson
                       ` (2 more replies)
  1 sibling, 3 replies; 15+ messages in thread
From: Anssi Saari @ 2006-05-29  7:57 UTC (permalink / raw)
  To: zsh-users

On Sun, May 28, 2006 at 11:32:00AM -0700, Bart Schaefer wrote:
> On May 28,  5:24pm, Meino Christian Cramer wrote:
> }
> }  Why can I execute the contents of the script "tempwatch" but not the
> }  script itsself?
> 
> That usually means that the program named in the #! line is not where
> the path in that line says it is.
 
Now that we're on the topic, I think bash does this a little better. If you have an
invalid interpreter, it tells you, like this:

bash: ./foo: /bin/foo: bad interpreter: No such file or directory

Maybe this could be improved with zsh?

> }  By the way: Does anyone know a trick how to remove _all_
> }  Escape-Sequences from a script generated by the command "script" ...
> 
> 	sed "s/[^"$'\t '"-~]//g"
> 
> The order of tab and space in $'\t ' is important.  The above actually
> strips anything that's not printable ASCII, so if you're using an ISO
> character set you probably need to put more stuff inside the [ ].

That doesn't really work for escape sequences now does it? For example, on
this machine, my prompt under script is shown in less like this:

^MESC[m^OESC[mESC[mESC[Jkuori% ESC[Kls^M

That sed removes the ^M and escapes, but what it leaves behind is 

[m[m[m[Jkuori% [K


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

* Re: Vanishing files ?
  2006-05-29  6:11     ` DervishD
@ 2006-05-29  8:56       ` Meino Christian Cramer
  2006-05-29  8:58         ` DervishD
  2006-05-30 21:59         ` Tobias Gruetzmacher
  0 siblings, 2 replies; 15+ messages in thread
From: Meino Christian Cramer @ 2006-05-29  8:56 UTC (permalink / raw)
  To: zsh; +Cc: zsh-users

From: DervishD <zsh@dervishd.net>
Subject: Re: Vanishing files ?
Date: Mon, 29 May 2006 08:11:19 +0200

Hi Raúl,

 the problem has been solved in between:
 The thing is, that vim and Microemacs are a little too smart as to be 
 helpful in this special case (and I myself didn't know that ;)

 My first line of the script was

 #!/bin/zsh^M

 and an interpreter with the name 'zsh^M' does not exist on my system.

 BANG!

 But the '^M' wasn't visible to me, since vim and Microemacs both
 recognized that file as to be "DOS-borne" and switches into DOS-mode
 internally. Vim and Microemacs have special modes to display
 all non-printable characters and would (as I thought in that moment) 
 display a stray ^M if switched to that mode.

 BUT they were als in DOS-mode, which means a ^M isn't a stray
 character but one half of the end of line in DOS mode (CR/LF instead
 of LF)

 So I only saw a "#!/bin/zsh$", which looks ok.

 The swiss army knife in this case was "cat". Cat doesn't know
 anything about DOS/UNIX or whatever. It simply pull everything 
 into visibility when called as "cat -v".

 And then there were light... ;O))

 Keep hacking and thanks a lot for your help!
 Meino
 


>     Hi Meino :)
> 
>  * Meino Christian Cramer <Meino.Cramer@gmx.de> dixit:
> > >  * Meino Christian Cramer <Meino.Cramer@gmx.de> dixit:
> > > >  Why can I execute the contents of the script "tempwatch" but not the
> > > >  script itsself?
> > > 
> > >     Probably because you don't have read or execute permissions for
> > > the script :?? You can execute the contents because you're entering
> > > them in the command line, but that has nothing to do with the
> > > problem you have.
> > 
> > 
> >   Hmmm...I did a 
> > 
> >     solfire:/home/mccramer>ls -l  bin/tmepwatch
> >     -rwxr-xr-x 1 mccramer users 79 May 28 20:36 bin/tmepwatch
> >     solfire:/home/mccramer>
> > 
> >  and it seems to be an X-file ;)
> 
>     It is!. Well, then the problem is probably that the first line of
> the script doesn't contain a valid interpreter. Could you please post
> the first line of bin/tmepwatch?
> 
>     Raúl Núñez de Arenas Coronado
> 
> -- 
> Linux Registered User 88736 | http://www.dervishd.net
> http://www.pleyades.net & http://www.gotesdelluna.net
> It's my PC and I'll cry if I want to... RAmen!
> 

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

* Re: Vanishing files ?
  2006-05-29  8:56       ` Meino Christian Cramer
@ 2006-05-29  8:58         ` DervishD
  2006-05-30 21:59         ` Tobias Gruetzmacher
  1 sibling, 0 replies; 15+ messages in thread
From: DervishD @ 2006-05-29  8:58 UTC (permalink / raw)
  To: Meino Christian Cramer; +Cc: zsh-users

    Hi Meino :)

 * Meino Christian Cramer <Meino.Cramer@gmx.de> dixit:
>  the problem has been solved in between:

    Yes, I've seen a minute ago, when I downloaded my email :) Bart
is a genius, not only with Zsh ;))

>  Keep hacking and thanks a lot for your help!

    You're more than welcome, and keep hacking, too :)

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to... RAmen!


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

* Re: Vanishing files ?
  2006-05-29  7:57   ` Anssi Saari
@ 2006-05-29 15:32     ` Peter Stephenson
  2006-05-29 17:51     ` Paul Lew
  2006-05-29 18:16     ` De-script (Re: Vanishing files ?) Bart Schaefer
  2 siblings, 0 replies; 15+ messages in thread
From: Peter Stephenson @ 2006-05-29 15:32 UTC (permalink / raw)
  To: zsh-users

Anssi Saari wrote:
> Now that we're on the topic, I think bash does this a little better. If you h
> ave an
> invalid interpreter, it tells you, like this:
> 
> bash: ./foo: /bin/foo: bad interpreter: No such file or directory

This turns out to be easy; the function already does path look up and
even has code to search for the interpreter (to emulate #! on older
systems where it wasn't implemented natively).  It relies on the error
being ENOENT (no such file or directory), not ENOEXEC (exec format
error); this is the case on all the systems I know about (haven't check
any relevant standards).

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.98
diff -u -r1.98 exec.c
--- Src/exec.c	19 Apr 2006 16:09:07 -0000	1.98
+++ Src/exec.c	29 May 2006 15:28:29 -0000
@@ -385,7 +385,7 @@
      * then check for an errno equal to ENOEXEC.  This errno is set *
      * if the process file has the appropriate access permission,   *
      * but has an invalid magic number in its header.               */
-    if ((eno = errno) == ENOEXEC) {
+    if ((eno = errno) == ENOEXEC || eno == ENOENT) {
 	char execvebuf[POUNDBANGLIMIT + 1], *ptr, *ptr2, *argv0;
 	int fd, ct, t0;
 
@@ -405,7 +405,14 @@
 			execvebuf[POUNDBANGLIMIT] = '\0';
 			for (ptr = execvebuf + 2; *ptr && *ptr == ' '; ptr++);
 			for (ptr2 = ptr; *ptr && *ptr != ' '; ptr++);
-			if (*ptr) {
+			if (eno == ENOENT) {
+			    char *buf;
+			    if (*ptr)
+				*ptr = '\0';
+			    buf = tricat("%s: bad interpreter: ", ptr2,
+					 ": %e");
+			    zerr(buf, pth, eno);
+			} else if (*ptr) {
 			    *ptr = '\0';
 			    argv[-2] = ptr2;
 			    argv[-1] = ptr + 1;
@@ -414,11 +421,11 @@
 			    argv[-1] = ptr2;
 			    execve(ptr2, argv - 1, environ);
 			}
-		    } else {
+		    } else if (eno == ENOEXEC) {
 			argv[-1] = "sh";
 			execve("/bin/sh", argv - 1, environ);
 		    }
-		} else {
+		} else if (eno == ENOEXEC) {
 		    for (t0 = 0; t0 != ct; t0++)
 			if (!execvebuf[t0])
 			    break;

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


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

* Re: Vanishing files ?
  2006-05-29  7:57   ` Anssi Saari
  2006-05-29 15:32     ` Peter Stephenson
@ 2006-05-29 17:51     ` Paul Lew
  2006-05-29 18:16     ` De-script (Re: Vanishing files ?) Bart Schaefer
  2 siblings, 0 replies; 15+ messages in thread
From: Paul Lew @ 2006-05-29 17:51 UTC (permalink / raw)
  To: Anssi Saari; +Cc: zsh-users

>>>>> "Anssi" == Anssi Saari <as@sci.fi> writes:

    Anssi> That doesn't really work for escape sequences now does it?
    Anssi> For example, on this machine, my prompt under script is
    Anssi> shown in less like this:

    Anssi> ^MESC[m^OESC[mESC[mESC[Jkuori% ESC[Kls^M

    Anssi> That sed removes the ^M and escapes, but what it leaves
    Anssi> behind is [m[m[m[Jkuori% [K

I used the following scripts for years, can be translated to zsh:

while (<>) {
        s/\015$//;
        s/^\015//;
        s/[^\010]\010//g;
        s/\033\[(;?\d+)*[a-zA-Z]//g;
        s/^\017//;              # ^O inserted by screen
        print;
        }


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

* De-script (Re: Vanishing files ?)
  2006-05-29  7:57   ` Anssi Saari
  2006-05-29 15:32     ` Peter Stephenson
  2006-05-29 17:51     ` Paul Lew
@ 2006-05-29 18:16     ` Bart Schaefer
  2 siblings, 0 replies; 15+ messages in thread
From: Bart Schaefer @ 2006-05-29 18:16 UTC (permalink / raw)
  To: zsh-users

On May 29, 10:57am, Anssi Saari wrote:
}
} > }  By the way: Does anyone know a trick how to remove _all_
} > }  Escape-Sequences from a script generated by the command "script" ...
} > 
} > 	sed "s/[^"$'\t '"-~]//g"
} 
} That doesn't really work for escape sequences now does it?

Ah, I see, I misinterpreted the original question.  In order to strip
entire terminal-control strings, you have to know what they are; which
means in effect that you have to (a) read the termcap/terminfo database
and (b) know the value of $TERM at the time the typescript was created.

You could create something to do this using the perl Term::Cap and/or
Term::Info modules, or in zsh with zsh/termcap and zsh/terminfo.  The
tricky bit is knowing which escapes use numeric counts or positions, so
you can accept arbitrary digits at those locations.

E.g. this is an UNTESTED example of what might work in zsh:

    function descript {
        ( # Subshell for parent terminal sanity
        emulate -R zsh
        typeset -A tpat
        TERM=${1:-$TERM}
        # Replace terminfo + echoti with termcap + echotc as needed
        for key in ${(k)terminfo}
        do
            [[ $terminfo[$key] == (yes|no) ]] && continue
	    # Replace programmable digits with the <-> pattern.
	    # If you have a 1000x1000 or larger terminal, I give up.
            tpat[$key]=${${(q)"$(echoti $key 998 998)"//$'\0'/}//99[89]/<->}
            # Debugging output:
            # print -u2 -R $key = ${(V)tpat[$key]}
        done
        pat=${(j:|:)tpat}
        # Run through "col" first to handle simple cursor movement
        col -bp | while read -r line
        do
            print -R -- ${line//(${~pat})/}
        done
        )
    }

Usage is e.g.:

    descript color-xterm < typescript

Also realize that after you strip those, the result is no longer going
to resemble what was visible on the screen during the creation of the
typescript.


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

* Re: Vanishing files ?
  2006-05-29  8:56       ` Meino Christian Cramer
  2006-05-29  8:58         ` DervishD
@ 2006-05-30 21:59         ` Tobias Gruetzmacher
  1 sibling, 0 replies; 15+ messages in thread
From: Tobias Gruetzmacher @ 2006-05-30 21:59 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 888 bytes --]

Hi,

On Mon, May 29, 2006 at 10:56:03AM +0200, Meino Christian Cramer wrote:
>  But the '^M' wasn't visible to me, since vim and Microemacs both
>  recognized that file as to be "DOS-borne" and switches into DOS-mode
>  internally. Vim and Microemacs have special modes to display
>  all non-printable characters and would (as I thought in that moment) 
>  display a stray ^M if switched to that mode.

Vim shows the fileformat it used when opening or writing the file:
"myscript" [dos] 3L, 21C

And you can show and change that setting with ":set fileformat?" and
":set fileformat=unix"

BTW: Vim only asumes fileformat=dos if all lines end with CRLF.

Greetings Tobi

-- 
GPG-Key 0xE2BEA341 - signed/encrypted mail preferred
My, oh so small, homepage: http://portfolio16.de/
http://www.fli4l.de/ - ISDN- & DSL-Router on one disk!
Registered FLI4L-User #00000003

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2006-05-30 21:59 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-28 15:24 Vanishing files ? Meino Christian Cramer
2006-05-28 18:32 ` Bart Schaefer
2006-05-28 18:38   ` Meino Christian Cramer
2006-05-28 23:24     ` Bart Schaefer
2006-05-29  2:38       ` Meino Christian Cramer
2006-05-29  7:57   ` Anssi Saari
2006-05-29 15:32     ` Peter Stephenson
2006-05-29 17:51     ` Paul Lew
2006-05-29 18:16     ` De-script (Re: Vanishing files ?) Bart Schaefer
2006-05-28 18:37 ` Vanishing files ? DervishD
2006-05-28 18:44   ` Meino Christian Cramer
2006-05-29  6:11     ` DervishD
2006-05-29  8:56       ` Meino Christian Cramer
2006-05-29  8:58         ` DervishD
2006-05-30 21:59         ` Tobias Gruetzmacher

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).