Re: man pdksh, I don't understand this - [ was: how to make colour prompts for pdksh ]

2006-07-27 Thread LeVA
2006. July 27. 00:40, LeVA:

Here I will post a solution and an explanation which was provided by 
Brian T. Brunner in a private mail conversation.

- START OF QUOTE -
   Hi!
  
  
   ... Note that since the command line editors try to figure out
   how 
   long the prompt is  (so  they  know how far it is to edge of the
   screen), escape codes in the prompt tend to mess things up. ...
  
   Okay, I get it, I'm using escape codes, so I need the following
   hack. 
  
   ... You can tell the shell not to count certain sequences (such
   as 
   escape codes) by  prefixing your prompt with a non-printing
   character 
   (such as control-A) followed by a carriage return and then
   delimiting 
   the escape codes with this non-printing  character.
  
   I've put my escape character to a variable to make things cleaner:
  
   ESC=^
 
  This look like an up-arrow, which is not what you need.
  Where you see ^[ there is to be just one character, the escape
  character.
 
  In vi/vim/gvim, as others have posted, in insert mode, use
  control-v ESC  
  making the obvious substitution) to insert a single escape character
  that will show up as ^[.

 It is the escape character, I was just using mcedit which displays it 
 like that. I'm just learning vim and can not use it as fast as other 
 editors.

 
  
   So if I have a simple prompt like this:
  
   PS1='$ESC[01;32m$USER '
  
   now if I prefix my prompt with a non-printing char (with control-A
   like suggested) then I get an error when starting the shell:
   /bin/pdksh: /home/leva/.profile[11]: no closing quote
  
   I see that I must put a carriage return after that, but I don't
   know how. How can I put a CR after the control-A (if control-A is
   what I need at all)? 
  
 
  To put a carriage return in a line, use control-v control-m
 
 Now that I know that :) Please tell me how to figure out those key 
 combos.

It's bleeding obvious, as soon as somebody explains (like many things).

Control characters start at 0 and go upwards from there to the
printable characters.

Control characters have a mapping to the characters @ABCDEFG...

So if you need a NULL character, ^@ will provide it, to insert a null
character in a 
string in a shell script you're editing with vi, control-v control-@
will do it.
If you need an STX character (binary 0x02), it's control-v control-b.
^m is the line feed, so to insert a line feed in a text string it's
control-v control-m
Likewise, the ^[ escape char is ...

now you need to figure out which control characters you'll need, and the
binary number 
of that control character, and what printable character that maps to,
then insert 
control-v control-mumble into your application-oriented
text-string-with-embedded-control-characters.

check http://en.wikipedia.org/wiki/ASCII about 2 screens down.

 And finally please allow me to post this to the debian-user list 
 including an example for the solution. I won't post until you ACK it.

 Thanks!

 Daniel

ACK!

- END OF QUOTE -


An example solution:

# This hack is needed so the command line doesn't get wrapped too soon
# with a coloured prompt

# Escape key entered with control+v + ESC
ESC=^[

# The non-printing character entered with control+v + control+a
NP=^A

# The carriage return character entered with control+v + control+m
CR=^M

PS1='$NP$CR $NP $ESC[01;32m $NP $USER $ $NP$ESC[0m$NP'
#^^ ^^^ ^^^ ^^^ ^
#|| ||| ||| ||| same as before
#|| ||| colour-code |||
#|| ||| |||
#prefix \\\ delimiter   ///


This will result in a green prompt like this:
leva $

The leading spaces are caused by the spaces surrounding the second and 
the third $NP strings. It goes without saying that those are not 
necessary, I just put them there to make the example cleaner.

And finally here is my fully functional final prompt:
PS1='$NP$CR$NP$ESC[01;32m$NP$USER$NP$ESC[0m$NP($NP$ESC[01;34m$NP$PWD\
$NP$ESC[0m$NP)$NP$ESC[01;[EMAIL PROTECTED] -s` $ $NP$ESC[0m$NP'

The prefix is needed only once (at the beginning), and the delimiter is 
needed to surround every instance of a colour-code.


Daniel

--
LeVA


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: how to make colour prompts for pdksh

2006-07-26 Thread James Strandboge
On Tue, 2006-07-25 at 22:59 +0200, LeVA wrote:
 2006. July 25. 21:20, James Strandboge:
  So a no frills color prompt without the title might be:
  PS1='^[[0;[EMAIL PROTECTED] ${PWD##*/}]$^[[m '
 
 Thanks a lot for the reply, I've tried it and it stays the same :\ just 
 spits out the characters, and no colours.

$ apt-cache policy pdksh
pdksh:
  Installed: 5.2.14-18
  Candidate: 5.2.14-18
  Version Table:
 *** 5.2.14-18 0
500 http://http.us.debian.org sarge/main Packages
100 /var/lib/dpkg/status

It works fine here.  Two things:

Are you *sure* that the control characters have been entered correctly?
It is not '^' followed by '['.  It must be the single charactor '^['.

Is your profile being sourced correctly?  I have to do this (and only
this) in ~/.profile:
ENV=$HOME/.kshrc; export ENV

and then add whatever to ~/.kshrc.  Try a blank .kshrc except for
setting PS1 (to make sure there are no syntax errors, etc).  I use the
same .profile and .kshrc file on Debian Sarge, Ubuntu Dapper, OpenBSD
and FreeBSD with no problems.

Jamie Strandboge

-- 
Anemone Computing
http://www.anemonecomputing.com/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: how to make colour prompts for pdksh

2006-07-26 Thread LeVA
2006. July 26. 14:32, James Strandboge:
 On Tue, 2006-07-25 at 22:59 +0200, LeVA wrote:
  2006. July 25. 21:20, James Strandboge:
   So a no frills color prompt without the title might be:
   PS1='^[[0;[EMAIL PROTECTED] ${PWD##*/}]$^[[m '
 
  Thanks a lot for the reply, I've tried it and it stays the same :\
  just spits out the characters, and no colours.

 $ apt-cache policy pdksh
 pdksh:
   Installed: 5.2.14-18
   Candidate: 5.2.14-18
   Version Table:
  *** 5.2.14-18 0
 500 http://http.us.debian.org sarge/main Packages
 100 /var/lib/dpkg/status

 It works fine here.  Two things:

 Are you *sure* that the control characters have been entered
 correctly? It is not '^' followed by '['.  It must be the single
 charactor '^['.

Now that your pointing this out for me :) indeed I was using a '^' char 
followed by a '['.
But how can I enter that control character? What is the keycombo for it?
 Is your profile being sourced correctly?  I have to do this (and only
 this) in ~/.profile:
 ENV=$HOME/.kshrc; export ENV
I'm putting everything in my .profile. It is always executed so I don't 
see any reason why I should create a .kshrc. BTW, I need you to clarify 
something for me please.
My setup looks like this:

~/.profile:
--###--
PS1='whatever...'
export PS1

alias df='df -h'
--###--

When I'm using a login shell, everything is working.
But when I'm using a non-login shell (in my case Konsole from KDE), then 
everything gets still sourced from my ~/.profile (so my PS1 
is 'whatever...') *BUT* the aliases are not working.
When I type `alias' to my non-login shell then it just prints out the 
builtin defaults. I think that the feature I need is alias exporting, 
which could be done with alias -x df='df -h', but pdksh doesn't 
support it yet(according to the authors homepage, this is still an 
existing bug).
Quote from http://www.cs.mun.ca/~michael/pdksh/NOTES :
General features of att ksh88 that are not (yet) in pdksh:
- exported aliases and functions (not in ksh93).

Can you confirm this or there is a misunderstanding in my head about 
this behaviour, and there is a way to make my aliases work in a 
non-login shell.

NOTE that if I type in the command `alias df='df -h'` in a non-login 
shell then I can use the alias, but I don't want to type in every alias 
everytime :)


 and then add whatever to ~/.kshrc.  Try a blank .kshrc except for
 setting PS1 (to make sure there are no syntax errors, etc).  I use
 the same .profile and .kshrc file on Debian Sarge, Ubuntu Dapper,
 OpenBSD and FreeBSD with no problems.

 Jamie Strandboge

Thanks for the reply

Daniel

-- 
LeVA


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: how to make colour prompts for pdksh

2006-07-26 Thread James Strandboge
On Wed, 2006-07-26 at 08:32 -0400, James Strandboge wrote:
 It works fine here.  Two things:

Actually, there is one more.  Check your TERM variable.  I use
gnome-terminal, which always sets TERM to 'xterm'.  This is fine for
GNU/Linux boxes, but ssh'ing into OpenBSD requires that TERM be set to
'xterm-color'.  'wsvt25' should be used on OpenBSD for console logins.
May also be needed on FreeBSD, but haven't checked.

So, I did this in in ~/.kshrc:
# hack because gnome-terminal always does 'xterm' and I need 'xterm-xfree86'
if [ $TERM == xterm ]
then
export TERM=xterm-xfree86
fi

Again, this is not needed for GNU/Linux boxes, both 'xterm' and
'linux' (for console logins) work fine without the above.  However,
using it doesn't hurt anything, so I set it up that way everywhere.

Jamie Strandboge
-- 
Anemone Computing
http://www.anemonecomputing.com/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: how to make colour prompts for pdksh

2006-07-26 Thread James Strandboge
On Wed, 2006-07-26 at 15:42 +0200, LeVA wrote:
 2006. July 26. 14:32, James Strandboge:
  On Tue, 2006-07-25 at 22:59 +0200, LeVA wrote:
  Are you *sure* that the control characters have been entered
  correctly? It is not '^' followed by '['.  It must be the single
  charactor '^['.
 
 Now that your pointing this out for me :) indeed I was using a '^' char 
 followed by a '['.
 But how can I enter that control character? What is the keycombo for it?

Check my previous email.  I don't know how to do it in vi
(unfortunately), but it can be done in emacs.

...

 When I'm using a login shell, everything is working.
 But when I'm using a non-login shell (in my case Konsole from KDE), then 
 everything gets still sourced from my ~/.profile (so my PS1 
 is 'whatever...') *BUT* the aliases are not working.

It needs to be a login shell, or have ENV set.  From the man page:
   If the basename of the name the shell is called  with  (i.e.,  argv[0])
   starts with - or if the -l option is used, the shell is assumed to be a
   login shell and the shell reads and executes the contents of  /etc/pro‐
   file and $HOME/.profile if they exist and are readable.

   If  the  ENV parameter is set when the shell starts (or, in the case of
   login shells, after any profiles are processed), its value is subjected
   to  parameter,  command,  arithmetic  and  tilde  substitution  and the
   resulting file (if any) is read and executed.  If ENV parameter is  not
   set  (and  not  null) and pdksh was compiled with the DEFAULT_ENV macro
   defined, the file named in that macro is included (after the above men‐
   tioned substitutions have been performed).

So either set konsole up to launch ksh as a login shell, or set ENV
somewhere.  You can test this with:

$ ENV=~/.profile konsole

Or launch konsole, and do:
$ ksh -l

If you setup .profile the way I suggested (eg, by setting ENV to
be .kshrc), konsole works properly.  For some reason, gnome-terminal
does not do this correctly, but it has a method of launching the shell
as a login session, which works just as well.

Jamie


-- 
Anemone Computing
http://www.anemonecomputing.com/



Re: how to make colour prompts for pdksh

2006-07-26 Thread Florian Kulzer
On Wed, Jul 26, 2006 at 10:35:56 -0400, James Strandboge wrote:
 On Wed, 2006-07-26 at 15:42 +0200, LeVA wrote:
  2006. July 26. 14:32, James Strandboge:
   On Tue, 2006-07-25 at 22:59 +0200, LeVA wrote:
   Are you *sure* that the control characters have been entered
   correctly? It is not '^' followed by '['.  It must be the single
   charactor '^['.
  
  Now that your pointing this out for me :) indeed I was using a '^' char 
  followed by a '['.
  But how can I enter that control character? What is the keycombo for it?
 
 Check my previous email.  I don't know how to do it in vi
 (unfortunately), but it can be done in emacs.

With vi, when you are in edit mode (-- INSERT -- etc.), you can press
CTRL + Q followed by ESC. (Release the other two keys again before
you press ESC.) If you use colors you will see that '^[' is shown in a
different color to indicate that it is a special character and not just
'^' + '['. It is furthermore treated as one character when you move the
cursor across it.

-- 
Regards,
  Florian


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: how to make colour prompts for pdksh

2006-07-26 Thread James Strandboge
On Wed, 2006-07-26 at 16:55 +0200, Florian Kulzer wrote:
 With vi, when you are in edit mode (-- INSERT -- etc.), you can press
 CTRL + Q followed by ESC. (Release the other two keys again before
 you press ESC.) If you use colors you will see that '^[' is shown in a
 different color to indicate that it is a special character and not just
 '^' + '['. It is furthermore treated as one character when you move the
 cursor across it. 

Cool, thanks.  However, at least in gnome-terminal, you should use
'CTRL + v' and not 'CTRL + q'.  From vim-doc usr_24.html:

*24.8*  Entering special characters

The CTRL-V command is used to insert the next character literally.  In other
words, any special meaning the character has, it will be ignored.  For
example:

CTRL-V Esc

Inserts an escape character.  Thus you don't leave Insert mode.  (Don't type
the space after CTRL-V, it's only to make this easier to read).

Note:
On MS-Windows CTRL-V is used to paste text.  Use CTRL-Q instead of
CTRL-V.  On Unix, on the other hand, CTRL-Q does not work on some
terminals, because it has a special meaning.


Jamie Strandboge

-- 
Anemone Computing
http://www.anemonecomputing.com/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: how to make colour prompts for pdksh

2006-07-26 Thread Derek Martin
On Wed, Jul 26, 2006 at 04:55:02PM +0200, Florian Kulzer wrote:
   Now that your pointing this out for me :) indeed I was using a
   '^' char followed by a '['.  But how can I enter that control
   character? What is the keycombo for it?
  
  Check my previous email.  I don't know how to do it in vi
  (unfortunately), but it can be done in emacs.
 
 With vi, when you are in edit mode (-- INSERT -- etc.), you can press
 CTRL + Q followed by ESC. (Release the other two keys again before
 you press ESC.) If you use colors you will see that '^[' is shown in a
 different color to indicate that it is a special character and not just
 '^' + '['. It is furthermore treated as one character when you move the
 cursor across it.

If I may be pedantic...  First of all you mean vim.  The original vi
does not support syntax coloring, and there are other vi clones which
may behave differently than you describe (like elvis, etc.).

Secondly, the key to use is dependent on your operating system and
terminal settings.  On Windows, the key seems to be CTRL-Q.  On
virtually any Unix platform, the default is CTRL-V but is configurable
by the user, using stty or similar terminal control programs.  The
setting is controlled by your terminal, not by vim per se.

You can see what it is currently set to using stty -a:

  $ stty -a
  speed 38400 baud; rows 24; columns 80; line = 0;
  intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = undef;
  eol2 = undef; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
  lnext = ^V; flush = ^O; min = 1; time = 0;
  -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
  -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
  -iuclc -ixany -imaxbel
  opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 
ff0
  isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
  echoctl echoke

Notice on the 4th line of output at the beginning, the entry 

  lnext = ^V

This is the key which is correct on your terminal.  The lnext
keyword is short for literal next character and is what you would
use to change the key using stty.  For example:

  stty lnext ^U

...changes the character to CTRL-U, though this isn't recommended as
^U normally corresponds to the kill character (not the same as the
kill command) by default.  These are the normal defaults for xterm and
its cousins, which are based on the DEC vt100 family of terminals, as
is the Linux console.  Note from the output above that ^Q is assigned
to start which is the XON character for terminal flow control, so it
will not work as advertised above on this terminal.

-- 
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D



pgpyZ80a8TE0I.pgp
Description: PGP signature


Re: how to make colour prompts for pdksh

2006-07-26 Thread LeVA
2006. July 26. 16:35, James Strandboge:
 On Wed, 2006-07-26 at 15:42 +0200, LeVA wrote:
  2006. July 26. 14:32, James Strandboge:
   On Tue, 2006-07-25 at 22:59 +0200, LeVA wrote:
   Are you *sure* that the control characters have been entered
   correctly? It is not '^' followed by '['.  It must be the single
   charactor '^['.
 
  Now that your pointing this out for me :) indeed I was using a '^'
  char followed by a '['.
  But how can I enter that control character? What is the keycombo
  for it?

 Check my previous email.  I don't know how to do it in vi
 (unfortunately), but it can be done in emacs.

 ...

  When I'm using a login shell, everything is working.
  But when I'm using a non-login shell (in my case Konsole from KDE),
  then everything gets still sourced from my ~/.profile (so my PS1 is
  'whatever...') *BUT* the aliases are not working.

 It needs to be a login shell, or have ENV set.  From the man page:
If the basename of the name the shell is called  with  (i.e., 
 argv[0]) starts with - or if the -l option is used, the shell is
 assumed to be a login shell and the shell reads and executes the
 contents of  /etc/pro‐ file and $HOME/.profile if they exist and are
 readable.

If  the  ENV parameter is set when the shell starts (or, in
 the case of login shells, after any profiles are processed), its
 value is subjected to  parameter,  command,  arithmetic  and  tilde 
 substitution  and the resulting file (if any) is read and executed. 
 If ENV parameter is  not set  (and  not  null) and pdksh was compiled
 with the DEFAULT_ENV macro defined, the file named in that macro is
 included (after the above men‐ tioned substitutions have been
 performed).

 So either set konsole up to launch ksh as a login shell, or set ENV
 somewhere.  You can test this with:

 $ ENV=~/.profile konsole

 Or launch konsole, and do:
 $ ksh -l
The .profile is always gets parsed (both in a login and a non-login 
shell). I can only set the ENV parameter in the .profile, because it is 
the first and only file which is used by pdksh when it starts. But 
setting the ENV parameter in the .profile file doesn't make any sense 
if I have a file (the .profile) which have already been parsed by 
pdksh. I can put all my variables and aliases etc... in to my .profile, 
and no need for another startup file.
But, I can see the ENV variable's meaning in another context, please 
read along.
When I start pdksh in a non-login shell, the .profile gets parsed, and 
the PATH and every other env.var. gets set. Only the aliases gets 
ignored, but why? Pdksh parses the alias commands too, why don't they 
appear in a non-login shell, and why do they appear in a login shell?
The .profile file is the same...

If I add the ENV=~/.kshrc line to my .profile and my ~/.kshrc contains 
my aliases, then I still can not see my aliases... And that is what 
I've expected, beacuse only by sourcing another file from an already 
parsed file doesn't make it working...
If I start konsole with 'ENV=~/.kshrc konsole' then my aliases are 
working. So this is solution no.1.

 If you setup .profile the way I suggested (eg, by setting ENV to
 be .kshrc), konsole works properly.
Unfortunatelly not. The solution which is working is the konsole 
starting method that you've suggested.

The man says that if the ENV parameter is set when the shell starts :)
This is funny because I can set the ENV parameter in a shell, and I can 
not set it before running the shell :) Something must be running 
already (eg. KDE) to be able to set up the variable. I can put a file 
which contains 'ENV=~/.kshrc' to my ~/.kde/env/ and that gets sourced 
by kde startup, so the ENV parameter will be set when I start konsole. 
Wait a minute... that is what I'm gonna do! :)

Daniel

-- 
LeVA



Re: how to make colour prompts for pdksh

2006-07-26 Thread Derek Martin
On Wed, Jul 26, 2006 at 09:47:39PM +0200, LeVA wrote:
  So either set konsole up to launch ksh as a login shell, or set ENV
  somewhere.  You can test this with:
 
  $ ENV=~/.profile konsole
 
  Or launch konsole, and do:
  $ ksh -l

 The .profile is always gets parsed (both in a login and a non-login 
 shell). 

This is not correct, unless you have a line such as the following in
your .profile:

  export ENV=~/.profile

However, your non-login shells will inherit exported variables from
your login shell, so your prompts will still be set, etc.  This is the
difference between variables that are exported and not exported.

 When I start pdksh in a non-login shell, the .profile gets parsed, and 
 the PATH and every other env.var. gets set. Only the aliases gets 
 ignored, but why?

Because you are mistaken...  the .profile does not get parsed.  The
environment variables are being inherited from the parent shell.  if
the .profile was being parsed, your aliases would be there too.
 

 If I add the ENV=~/.kshrc line to my .profile and my ~/.kshrc contains 
 my aliases, then I still can not see my aliases... 

You need to export ENV.  This can be done as I did above, or like
this:

  ENV=~/.profile; export ENV

 The man says that if the ENV parameter is set when the shell starts :)
 This is funny because I can set the ENV parameter in a shell, and I can 
 not set it before running the shell :) 

Yes you can... you can export it from a parent shell.

 Something must be running already (eg. KDE) to be able to set up the
 variable. I can put a file which contains 'ENV=~/.kshrc' to my
 ~/.kde/env/ and that gets sourced by kde startup, so the ENV
 parameter will be set when I start konsole.  Wait a minute... that
 is what I'm gonna do! :)

And if you tried that, it didn't work either... because you didn't
export ENV.

-- 
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D



pgpUsjMTvqgTr.pgp
Description: PGP signature


man pdksh, I don't understand this - [ was: how to make colour prompts for pdksh ]

2006-07-26 Thread LeVA
Hi!


... Note that since the command line editors try to figure out how long 
the prompt is  (so  they  know how far it is to edge of the screen), 
escape codes in the prompt tend to mess things up. ...

Okay, I get it, I'm using escape codes, so I need the following hack.

... You can tell the shell not to count certain sequences (such as 
escape codes) by  prefixing your prompt with a non-printing character 
(such as control-A) followed by a carriage return and then delimiting 
the escape codes with this non-printing  character.

I've put my escape character to a variable to make things cleaner:

ESC=^

So if I have a simple prompt like this:

PS1='$ESC[01;32m$USER '

now if I prefix my prompt with a non-printing char (with control-A like 
suggested) then I get an error when starting the shell:
/bin/pdksh: /home/leva/.profile[11]: no closing quote

I see that I must put a carriage return after that, but I don't know 
how. How can I put a CR after the control-A (if control-A is what I 
need at all)?

Daniel

-- 
LeVA


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: how to make colour prompts for pdksh

2006-07-26 Thread LeVA
2006. July 27. 00:28, Derek Martin:
 On Wed, Jul 26, 2006 at 09:47:39PM +0200, LeVA wrote:
   So either set konsole up to launch ksh as a login shell, or set
   ENV somewhere.  You can test this with:
  
   $ ENV=~/.profile konsole
  
   Or launch konsole, and do:
   $ ksh -l
 
  The .profile is always gets parsed (both in a login and a non-login
  shell).

 This is not correct, unless you have a line such as the following in
 your .profile:

   export ENV=~/.profile

 However, your non-login shells will inherit exported variables from
 your login shell, so your prompts will still be set, etc.  This is
 the difference between variables that are exported and not exported.

  When I start pdksh in a non-login shell, the .profile gets parsed,
  and the PATH and every other env.var. gets set. Only the aliases
  gets ignored, but why?

 Because you are mistaken...  the .profile does not get parsed.  The
 environment variables are being inherited from the parent shell.  if
 the .profile was being parsed, your aliases would be there too.

  If I add the ENV=~/.kshrc line to my .profile and my ~/.kshrc
  contains my aliases, then I still can not see my aliases...

 You need to export ENV.  This can be done as I did above, or like
 this:

   ENV=~/.profile; export ENV

  The man says that if the ENV parameter is set when the shell
  starts :) This is funny because I can set the ENV parameter in a
  shell, and I can not set it before running the shell :)

 Yes you can... you can export it from a parent shell.

  Something must be running already (eg. KDE) to be able to set up
  the variable. I can put a file which contains 'ENV=~/.kshrc' to
  my ~/.kde/env/ and that gets sourced by kde startup, so the ENV
  parameter will be set when I start konsole.  Wait a minute... that
  is what I'm gonna do! :)

 And if you tried that, it didn't work either... because you didn't
 export ENV.
Okay okay I got it thanks! :D

Daniel


-- 
LeVA


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



how to make colour prompts for pdksh

2006-07-25 Thread LeVA
Hi!

I want to make my shell's prompt colourful :)

I'm using pdksh. There are tons of information provided by google, but 
none of them are working.

Setting my prompt to:
PS1=$'\E[31m'[EMAIL PROTECTED]'\E[1;33m'`hostname -s`:$'\E[0m'

makes my prompt:
[EMAIL PROTECTED];33mleva:$\E[0m

The colour codes gets ignored. Is this only working with the original 
korn shell? Is there colour support for the public domain korn shell?

Thanks!

Daniel

-- 
LeVA


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: how to make colour prompts for pdksh

2006-07-25 Thread Leinier C. Salfran
El mar, 25-07-2006 a las 17:01 +0200, LeVA escribió:
 Hi!
 
 I want to make my shell's prompt colourful :)
 
 I'm using pdksh. There are tons of information provided by google, but 
 none of them are working.
 
 Setting my prompt to:
 PS1=$'\E[31m'[EMAIL PROTECTED]'\E[1;33m'`hostname -s`:$'\E[0m'
 
 makes my prompt:
 [EMAIL PROTECTED];33mleva:$\E[0m
 
 The colour codes gets ignored. Is this only working with the original 
 korn shell? Is there colour support for the public domain korn shell?
 
 Thanks!
 
 Daniel
 
 -- 
 LeVA
 
 

Hi .. I never used this but I can say you that you are using 'text
strings' in that variable .. Everything you put enclosed in ' and  is a
'text string' in c, perl, php, bash and others.

PS1=$'\E[31m'[EMAIL PROTECTED]'\E[1;33m'`hostname -s`:$'\E[0m'

The result looks like this 

PS1=$'\E[31m'[EMAIL PROTECTED]'\E[1;33m'`hostname -s`:$'\E[0m'
$ \E[31m  [EMAIL PROTECTED] \E[1;33m  leva:$ \E[0m

Do you see?

Try to eliminate ' and try .. Maybe it works.


-- 
Leinier C. Salfran [EMAIL PROTECTED]
IPI Jose Maceo Grajales


signature.asc
Description: Esta parte del mensaje está firmada	digitalmente


Re: how to make colour prompts for pdksh

2006-07-25 Thread Santhosh Loganathan
hello sir,
 They are different types packages that provides you the solution. if you want in shell to be displayed in color means just use package vim-enhanced(by installing ) and reboot the machine as per linux idea. try to install the latest versions..


 thanks for communicating me
 by ,
 santhosh
 
 


Re: how to make colour prompts for pdksh

2006-07-25 Thread LeVA
2006. July 25. 18:29, Leinier C. Salfran:
 El mar, 25-07-2006 a las 17:01 +0200, LeVA escribió:
  Hi!
 
  I want to make my shell's prompt colourful :)
 
  I'm using pdksh. There are tons of information provided by google,
  but none of them are working.
 
  Setting my prompt to:
  PS1=$'\E[31m'[EMAIL PROTECTED]'\E[1;33m'`hostname -s`:$'\E[0m'
 
  makes my prompt:
  [EMAIL PROTECTED];33mleva:$\E[0m
 
  The colour codes gets ignored. Is this only working with the
  original korn shell? Is there colour support for the public domain
  korn shell?
 
 Hi .. I never used this but I can say you that you are using 'text
 strings' in that variable .. Everything you put enclosed in ' and 
 is a 'text string' in c, perl, php, bash and others.

 PS1=$'\E[31m'[EMAIL PROTECTED]'\E[1;33m'`hostname -s`:$'\E[0m'

 The result looks like this

 PS1=$'\E[31m'[EMAIL PROTECTED]'\E[1;33m'`hostname -s`:$'\E[0m'
 $ \E[31m  [EMAIL PROTECTED] \E[1;33m  leva:$ \E[0m

 Do you see?

 Try to eliminate ' and try .. Maybe it works.
The colourless version of the prompt is working with '' enclosing, and 
it is supposed to work (not just by accident :). The problem lays 
behind the colour code handling.
My prompt looks like this now:
PS1='@`hostname -s`:$USER($PWD) $ '

This is working, so I started from there. I've added the colour codes, 
but pdksh doesn't handle them.

C'mon, I can't beleive that nobody is using the korn shell :)

Daniel

-- 
LeVA



Re: how to make colour prompts for pdksh

2006-07-25 Thread LeVA
2006. July 25. 18:51, Santhosh Loganathan:
 hello sir,
 They are different types packages that provides you
 the solution. if you want in shell to be displayed in color means
 just use package vim-enhanced(by installing ) and reboot the machine
 as per linux idea. try to install the latest versions..

thanks for communicating
 me by ,
 santhosh

I don't get this :\

Daniel

-- 
LeVA


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: how to make colour prompts for pdksh

2006-07-25 Thread LeVA
2006. July 25. 19:48, LeVA:
 2006. July 25. 18:29, Leinier C. Salfran:
  El mar, 25-07-2006 a las 17:01 +0200, LeVA escribió:
   Hi!
  
   I want to make my shell's prompt colourful :)
  
   I'm using pdksh. There are tons of information provided by
   google, but none of them are working.
  
   Setting my prompt to:
   PS1=$'\E[31m'[EMAIL PROTECTED]'\E[1;33m'`hostname -s`:$'\E[0m'
  
   makes my prompt:
   [EMAIL PROTECTED];33mleva:$\E[0m
  
   The colour codes gets ignored. Is this only working with the
   original korn shell? Is there colour support for the public
   domain korn shell?
 
  Hi .. I never used this but I can say you that you are using 'text
  strings' in that variable .. Everything you put enclosed in ' and 
  is a 'text string' in c, perl, php, bash and others.
 
  PS1=$'\E[31m'[EMAIL PROTECTED]'\E[1;33m'`hostname -s`:$'\E[0m'
 
  The result looks like this
 
  PS1=$'\E[31m'[EMAIL PROTECTED]'\E[1;33m'`hostname -s`:$'\E[0m'
  $ \E[31m  [EMAIL PROTECTED] \E[1;33m  leva:$ \E[0m
 
  Do you see?
 
  Try to eliminate ' and try .. Maybe it works.

 The colourless version of the prompt is working with '' enclosing,
 and it is supposed to work (not just by accident :). The problem lays
 behind the colour code handling.
 My prompt looks like this now:
 PS1='@`hostname -s`:$USER($PWD) $ '

 This is working, so I started from there. I've added the colour
 codes, but pdksh doesn't handle them.

 C'mon, I can't beleive that nobody is using the korn shell :)
Well, maybe someone is using it, but unfortunatelly I've just tested 
this with the original korn shell (the package named ksh) and this is 
working with it. It seems pdksh is not just a bit different from 
ksh...

Daniel

-- 
LeVA



Re: how to make colour prompts for pdksh

2006-07-25 Thread Mumia W.

On 07/25/2006 11:29 AM, Leinier C. Salfran wrote:

El mar, 25-07-2006 a las 17:01 +0200, LeVA escribió:

Hi!

I want to make my shell's prompt colourful :)

I'm using pdksh. There are tons of information provided by google, but 
none of them are working.


Setting my prompt to:
PS1=$'\E[31m'[EMAIL PROTECTED]'\E[1;33m'`hostname -s`:$'\E[0m'

makes my prompt:
[EMAIL PROTECTED];33mleva:$\E[0m

The colour codes gets ignored. Is this only working with the original 
korn shell? Is there colour support for the public domain korn shell?


Thanks!

Daniel

--
LeVA




Hi .. I never used this but I can say you that you are using 'text
strings' in that variable .. Everything you put enclosed in ' and  is a
'text string' in c, perl, php, bash and others.

PS1=$'\E[31m'[EMAIL PROTECTED]'\E[1;33m'`hostname -s`:$'\E[0m'

The result looks like this 


PS1=$'\E[31m'[EMAIL PROTECTED]'\E[1;33m'`hostname -s`:$'\E[0m'
$ \E[31m  [EMAIL PROTECTED] \E[1;33m  leva:$ \E[0m

Do you see?

Try to eliminate ' and try .. Maybe it works.




I know /zip/ about {pd}ksh, but, in bash, $'text' is a special 
syntax that recognizes special character codes such as \E 
(escape). Under bash, that PS1 string works as expected.


LeVA, it looks like you got advice on how to change the prompt 
color in bash, but you're using it for pdksh; pdksh probably 
has a completely different way to change the prompt color.




--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: how to make colour prompts for pdksh

2006-07-25 Thread James Strandboge
On Tue, 2006-07-25 at 19:48 +0200, LeVA wrote:
...
 This is working, so I started from there. I've added the colour codes, 
 but pdksh doesn't handle them.
 
 C'mon, I can't beleive that nobody is using the korn shell :)

This is not a tutorial or anything and most of this can be found
googling, but this is my prompt:
PS1='^[]0;[EMAIL PROTECTED] ${PWD##*/}^G^M^[[0;[EMAIL PROTECTED] 
${PWD##*/}]$^[[m '

Note that the ^[ and ^G in the prompt string are single characters for
ESC and BEL (can be entered in emacs using C-q ESC and C-q C-g).  The
^M is a carriage return (C-q C-m in emacs), and needs to be used after
other escape characters in the prompt, so ksh can determine the screen
width properly.  I couldn't figure out a way to enter these control
characters with vi, but I didn't try too terribly hard either.  The
${PWD##*/} is a ksh construct to get the basename of the directory you
are in.

This part sets the title: 
^[]0;[EMAIL PROTECTED] ${PWD##*/}^G^M

This part set the prompt (with color): 
^[[0;[EMAIL PROTECTED] ${PWD##*/}]$^[[m 


So a no frills color prompt without the title might be:
PS1='^[[0;[EMAIL PROTECTED] ${PWD##*/}]$^[[m '

Jamie Strandboge

-- 
Anemone Computing
http://www.anemonecomputing.com/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: how to make colour prompts for pdksh

2006-07-25 Thread LeVA
2006. July 25. 21:20, James Strandboge:
 On Tue, 2006-07-25 at 19:48 +0200, LeVA wrote:
 ...

  This is working, so I started from there. I've added the colour
  codes, but pdksh doesn't handle them.
 
  C'mon, I can't beleive that nobody is using the korn shell :)

 This is not a tutorial or anything and most of this can be found
 googling, but this is my prompt:
 PS1='^[]0;[EMAIL PROTECTED] ${PWD##*/}^G^M^[[0;[EMAIL PROTECTED]
 ${PWD##*/}]$^[[m '

 Note that the ^[ and ^G in the prompt string are single characters
 for ESC and BEL (can be entered in emacs using C-q ESC and C-q C-g). 
 The ^M is a carriage return (C-q C-m in emacs), and needs to be used
 after other escape characters in the prompt, so ksh can determine the
 screen width properly.  I couldn't figure out a way to enter these
 control characters with vi, but I didn't try too terribly hard
 either.  The ${PWD##*/} is a ksh construct to get the basename of the
 directory you are in.

 This part sets the title:
 ^[]0;[EMAIL PROTECTED] ${PWD##*/}^G^M

 This part set the prompt (with color):
 ^[[0;[EMAIL PROTECTED] ${PWD##*/}]$^[[m


 So a no frills color prompt without the title might be:
 PS1='^[[0;[EMAIL PROTECTED] ${PWD##*/}]$^[[m '

Thanks a lot for the reply, I've tried it and it stays the same :\ just 
spits out the characters, and no colours.
I've tried it with ksh (the original, not the public domain) and it is 
working as expected. So it seems to me that pdksh is broken; or not... 
I don't know. I thought that pdksh wants to clone ksh88 and ksh93. 
This rewrite indeed implements some features from ksh88 and some from 
ksh93, but surely not all, and some of them are broken. The 
maintainer's latest version dates back to '99 and I just saw the 
existing bugs' page... I could've passed over this colour trouble, but 
the alias exporting is not working which I surely need.
As I don't want to use the original ksh (although it is working :) I 
guess I'm just stuck with the good old bash, and use pdksh on my bsds.

Thanks for your efforts, and help.

Daniel

-- 
LeVA


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]