Ellipsis, as in proper punctuation, like this? http://webster.commnet.edu/grammar/marks/ellipsis.htm
What use do you have for that in a terminal? Can't you just type three periods? ... Or are you displaying text that already has ellipsis in it?
Brian Kelsay
Gerald Combs gerald@ethereal.com 02/09/05 10:57PM >>>
Is there any way within bash to display an ellipsis character in xterm, PuTTY, or other terminals in common use?
Brian Kelsay wrote:
Ellipsis, as in proper punctuation, like this? http://webster.commnet.edu/grammar/marks/ellipsis.htm
What use do you have for that in a terminal? Can't you just type three periods? ... Or are you displaying text that already has ellipsis in it?
That's what I'm doing right now. I'd prefer to use a genuine all-three-dots-in-one-character-cell ellipsis entity, however.
After using tcsh for a _long_ time, I recently switched to bash. Under tcsh, I set my "prompt" shell variable to "%m:%B%C2%b%# ". The "%C2" bit means "print the last two elements of $CWD. E.g., if I'm in /tmp/a/very/long/path/indeed, my prompt would show up as
pow:path/indeed>
This functionality isn't built into bash, unfortunately. As a workaround I borrowed a function from the Bash Prompt HOWTO which truncates my path like so:
pow:...ery/long/path/indeed$
I'm looking for a way to use a real ellipsis instead of three dots _and_ have it work in different terminals on different platforms. It's 2005. Where's the Unicode-y goodness?
On Thursday 10 February 2005 09:38, Gerald Combs wrote:
This functionality isn't built into bash, unfortunately. As a workaround I borrowed a function from the Bash Prompt HOWTO which truncates my path like so:
pow:...ery/long/path/indeed$
I'm looking for a way to use a real ellipsis instead of three dots _and_ have it work in different terminals on different platforms. It's 2005. Where's the Unicode-y goodness?
!!! WARNING UNICODE AHEAD -- MUST HAVE UNICODE ENABLED !!! !!! EMAIL IS UNICODE UTF-8 ENCODED !!!
Well first of all, woops on my earlier post.
Now, the following works in an XTerm on my Debian system:
PS1=…
The last character in the line above is a Unicode ellipse from the U+2026 block which can be included in any bash script in it's literal form if your locale is set to en_US.UTF-8. Here is an example of unicode literals in bash:
jclinton@mail:~$ cat myscript #!/bin/bash STRING=…Sigur\ Rós/ágætis_byrjun/$ echo $STRING jclinton@mail:~$ ./myscript …Sigur Rós/ágætis_byrjun/$
This also works in PuTTY on Windows XP; you must tell PuTTY that the console is UTF-8.
As for the non-GUI Linux console, it also works (theoretically) if one runs unicode_start first which could be included in one's special .bashrc AND if a suitable UTF-8 font is pressent. I couldn't find a font that had the ellipse character in it. Also, the Linux console is sorely lacking in a number of areas. In UTF-8 mode, you cannot use apps that draw lines on the screen or use the dead keys system to input arbitrary Unicode codes.
As for enabling Unicode on systems all you need to do, on Debian at least, is make /etc/environment file look like this:
jclinton@mail:/etc$ cat environment LANGUAGE="en_US:en_GB:en"
LANG=en_US.UTF-8
And that does it. It won't affect the console so things will still work there and XTerms, it seems, are intelligent enough in UTF-8 mode to handle all the things that they should be able to. Also, root is unaffected by LANG.
Jason Clinton wrote:
!!! WARNING UNICODE AHEAD -- MUST HAVE UNICODE ENABLED !!! !!! EMAIL IS UNICODE UTF-8 ENCODED !!!
Yay Thunderbird.
The last character in the line above is a Unicode ellipse from the U+2026 block which can be included in any bash script in it's literal form if your locale is set to en_US.UTF-8. Here is an example of unicode literals in bash:
Thanks! I have it working for bash and vim under PuTTY. I'll see how it works for xterm/konsole when I get home.
Jason Clinton wrote:
On Thursday 10 February 2005 15:58, Gerald Combs wrote:
Thanks! I have it working for bash and vim under PuTTY. I'll see how it works for xterm/konsole when I get home.
So did it work?
I ended up creating a "en_US.utf8" locale and setting it system-wide, but it works fine. Once again, thanks!
Bonus question:
How do you insert the name of the currently-running foreground process into the xterm title bar using bash? Tcsh has the inappropriately-named "postcmd" alias that runs just before each command is executed. Putting
alias precmd 'echo -n "^[]0;Rufus [$cwd]^G"' alias postcmd 'echo -n "^[]0;Rufus !#:0 [$cwd]^G"'
in my .login will display "Rufus vim [/the/current/directory]" in my title bar when I'm running vim, and "Rufus [/the/current/directory]" at a regular shell prompt, for example. A bit of Googling turned up a couple of message threads that said "use zsh." Thanks. Really helpful.
On Friday 11 February 2005 02:47 pm, Gerald Combs wrote:
How do you insert the name of the currently-running foreground process into the xterm title bar using bash?
I'm not sure that the shell is what supplies that. Most of my bash shells do this in xterm without any intervention from me.
On Fri, Feb 11, 2005 at 02:47:22PM -0600, Gerald Combs wrote:
Bonus question:
How do you insert the name of the currently-running foreground process into the xterm title bar using bash? Tcsh has the inappropriately-named "postcmd" alias that runs just before each command is executed. Putting
alias precmd 'echo -n "^[]0;Rufus [$cwd]^G"' alias postcmd 'echo -n "^[]0;Rufus \!#:0 [$cwd]^G"'
in my .login will display "Rufus vim [/the/current/directory]" in my title bar when I'm running vim, and "Rufus [/the/current/directory]" at a regular shell prompt, for example. A bit of Googling turned up a couple of message threads that said "use zsh." Thanks. Really helpful.
You probably want to insert a similar command into the PROMPT_COMMAND environment variable. It's description from the bash man page is as follows:
If set, the value is executed as a command prior to issuing each primary prompt.
It seems that bash doesn't give you the "post" command funtionality that tcsh provides.
Charles K. Lee II wrote:
You probably want to insert a similar command into the PROMPT_COMMAND environment variable. It's description from the bash man page is as follows:
If set, the value is executed as a command prior to issuing each primary prompt.
But doesn't that happen after the fact? I want to display the command name in the title bar while the command is running.