Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Getting around tcsh bugs' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Getting around tcsh bugs
Authored by: hysterion on Jan 25, '03 12:09:49AM
[Editor's note: There are a few other useful terminal titling tricks on the site as well: 1, 2, 3, 4, 5...]
Regarding hint #2 here ("Display current jobs in Terminal titles"): Recently Marc Liyanage suggested yet another addendum to it. Namely, instead of echo he uses printf with a variable substitution, thus:
sched +0:00 alias postcmd "printf '^[]0;%s^G' 'BACKSLASH!#'"
(Note that BACKSLASH stands for the ever-geeklog-unfriendly backslash -- let's hope this finally gets fixed rsn... -- and that I have switched quotes ' and double quotes " in Marc's version.) The advantage is that, at least on my machine, this gets around the two known tcsh bugs already discussed under that hint:
  • if you had anything aliased to ls, then postcmd would eat its first output line;
  • if you passed an undefined variable $foo to the shell, it would barf and declare the alias `faulty'.
One more thing: somehow Marc seems able to replace the escape sequences ^[ and ^G here by BACKSLASH033 and BACKSLASH007, so that one could presumably enter this stuff using BBEdit rather than vi. Unfortunately I'm not able to get this to work. So, can anyone point to a vi-/emacs-free way?

[ Reply to This | # ]
Getting around tcsh bugs
Authored by: hysterion on Feb 07, '03 09:46:55AM
Just a word to confirm that the line with printf, \033 and \007 in place of echo, ^[ and ^G does work in BBEdit Lite. (This applies, of course, also to the precmd line of this hint.) My initial failure was due to the conjunction of three conditions:
  • The line must be terminated by a Unix line break (aka newline, ascii 0a);
  • Unlike vi, BBEdit Lite does not automatically insert such a break at ends of files;
  • If in BBEdit Lite you save, close and reopen a file which contains no Unix line breaks, it switches to Mac line breaks (ascii 0d) even if preferences are set to Unix.
So it took some time to understand why the shell couldn't see the newlines I was inserting. Apparently this bug is fixed in BBEdit 6.5.1: "When opening a file that contains no line-break characters (possibly because it's empty), BBEdit will use the preferred line-break setting (Text Files:Saving) instead of assuming the Mac line-break convention." (Also, TextEdit works fine for this.)

Besides that, I was also a little overoptimistic about the postcmd line above -- it still needs a bit more work. But since this is not directly relevant to the present hint, I've put that info where it belongs.

[ Reply to This | # ]