Hugues Moretto-Viry dixit:
>If you have enough time, I would appreciate it.
Sure, no problem.
>The PS1 included in the previous email ends with \e[0m. As you said it, the
>changes are small.
>I also added a little description, maybe you'll need it.
OK ;-)
>>PS: Feel free to re-bounce these mails to the mailing list,
>> there’s nothing private in here I guess.
>How can I do that? I have to send the mails to miros-discuss too?
miros-mksh actually, but yes. If you agree, I’ll just bounce these
past messages to that list as well.
The converted PS1, with ESC [ 0 m at the end, is thus:
PS1=$'\a\r\a\e[1;34m\a┌─| \a\e[36m\a${USER:=$(ulimit -c 0; \
id -un 2>/dev/null || echo \?)}\a\e[34m\a |──| \a\e[0;33m\a$(
local d=${PWD:-?} p=~
[[ $p = ?(*/) ]] || d=${d/#$p/~}
print -nr -- "$d"
)\a\e[1;34m\a |\n└─| \a\e[32m\a$(date +%H:%M)\a\e[34m\a |─>>\a\e[0m\a '
You might also like this variant:
PS1=$'\a\r\a\e[1;34m\a┌─┤ \a\e[36m\a${USER:=$(ulimit -c 0; \
id -un 2>/dev/null || echo \?)}\a\e[34m\a ├──┤ \a\e[0;33m\a$(
local d=${PWD:-?} p=~
[[ $p = ?(*/) ]] || d=${d/#$p/~}
print -nr -- "$d"
)\a\e[1;34m\a │\n└─┤ \a\e[32m\a$(date +%H:%M)\a\e[34m\a ├─»\a\e[0m\a '
There’s also ↠ or ⇾ or ‣ or ➔ or ➙ or ➛ or ➜ or ➝ or ➞ or ➟
or ➢/➣/➤ or ➨ or ➩ or ➳ or ➸ or ➼ or ➾ or ▶ or ▷ or lots of
other Unicode/UTF-8 characters you could use… people call
me “Mr. WTF-8” for a reason ☺
If you have tmpfs on ${TMPDIR:-/tmp} then you can use this
with mksh R43 or newer:
PS1=$'\a\r\a\e[1;34m\a┌─| \a\e[36m\a${USER:=$(ulimit -c 0; \
id -un 2>/dev/null || echo \?)}\a\e[34m\a |──| \a\e[0;33m\a${
local e=$? d=${PWD:-?} p=~
[[ $p = ?(*/) ]] || d=${d/#$p/~}
print -nr -- "$d"
return $e
}\a\e[1;34m\a |\n└─| \a\e[32m\a${
local e=$?
date +%H:%M
return $e
}\a\e[34m\a |─>>\a\e[0m\a '
This saves two fork() calls at the expense of tmpfile
creation (the extra 'local e=$?' and 'return $e' are
necessary because these subcommands are run in the
same context as the shell, so an 'echo $?' on the
command line will keep working).
bye,
//mirabilos
--
«MyISAM tables -will- get corrupted eventually. This is a fact of life. »
“mysql is about as much database as ms access” – “MSSQL at least descends
from a database” “it's a rebranded SyBase” “MySQL however was born from a
flatfile and went downhill from there” – “at least jetDB doesn’t claim to
be a database” -- Tonnerre, psychoschlumpf and myself in #nosec