Re: [leaf-user] Bourne SHell prompt problems

2002-08-09 Thread David Douthitt

On Fri, Jul 05, 2002 at 10:25:23AM -0500, Charles Steinkuehler wrote:
  I've tried about fifteen ways to get the prompt to look like this:
 
  [root@firewall /usr/sbin]#   --- where /usr/sbin is a current
  working directory

 To get PWD as part of the prompt in ash, you have to intercept the cd
 command (and other commands that might change your directory)...details
 are available in the SF FAQ-o-matic:
 
 http://sourceforge.net/docman/display_doc.php?docid=5178group_id=13751

This is also a shell FAQ; look at http://www.faqs.org and look at
the comp.unix.shell FAQ, question 2.4: How do I get the current directory
into my prompt?

Others have explained it already, but there you go anyway.



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html



Re: [leaf-user] Bourne SHell prompt problems

2002-07-05 Thread Michael D. Schleif


Rob Fegley wrote:
 
 I've tried about fifteen ways to get the prompt to look like this:
 
 [root@firewall /usr/sbin]#   --- where /usr/sbin is a current working directory

I use bash; so, I cannot vouch for ash:

# PS1=`echo -n -e [$USER@$HOSTNAME $HOME]# `
[root@trout /root]#

hth

-- 

Best Regards,

mds
mds resource
888.250.3987

Dare to fix things before they break . . .

Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . .


---
This sf.net email is sponsored by:ThinkGeek
Bringing you mounds of caffeinated joy.
http://thinkgeek.com/sf

leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html



Re: [leaf-user] Bourne SHell prompt problems

2002-07-05 Thread Julio Gazquez

On Fri, 5 Jul 2002, Rob Fegley wrote:

 I've tried about fifteen ways to get the prompt to look like this:

 [root@firewall /usr/sbin]#   --- where /usr/sbin is a current working directory

 to no avail.  The best I ever get is /root, which was the value of $PWD (or output 
of `pwd`) at the time that the PS1 was exported.  The following line is what I want:

 echo -n -e \n[$USER@$HOSTNAME `/bin/pwd`]# 

 At least, it works from the shell, just not within the construct of an exported 
variable.  The embedded command always gets parsed upon export of the variable rather 
than when the variable is called.  Any thoughts?  If not, has anyone compiled a bash 
package for Bering or another LEAF variant?  Thanks, again!

I guess there is no way to do that with ash shell.

In bash, you need to do:

PS1='[\u@\h \w]\$'

However bash is probably too BIG for a floppy. You can look for an ancient
version of bash and compile yourself, but IMO it doesn't worth it.

-- 
Julio César Gázquez
Area Redes, Informatica y Comunicaciones
UTN - Facultad Regional Rosario
http://www.frro.utn.edu.ar





---
This sf.net email is sponsored by:ThinkGeek
Bringing you mounds of caffeinated joy.
http://thinkgeek.com/sf

leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html



Re: [leaf-user] Bourne SHell prompt problems

2002-07-05 Thread Mike Noyes

On Fri, 2002-07-05 at 06:26, Rob Fegley wrote:
 At least, it works from the shell, just not within the construct of
 an exported variable.  The embedded command always gets parsed upon
 export of the variable rather than when the variable is called.  Any
 thoughts?  If not, has anyone compiled a bash package for Bering or
 another LEAF variant?  Thanks, again!

Rob,
Charles packaged Bash 2.01.1(1). 
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/leaf/bin/packages/glibc-2.0/

-- 
Mike Noyes [EMAIL PROTECTED]
http://sourceforge.net/users/mhnoyes/
http://leaf-project.org/



---
This sf.net email is sponsored by:ThinkGeek
Bringing you mounds of caffeinated joy.
http://thinkgeek.com/sf

leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html



Re: [leaf-user] Bourne SHell prompt problems

2002-07-05 Thread Michael D. Schleif


Michael D. Schleif wrote:
 
 Rob Fegley wrote:
 
  I've tried about fifteen ways to get the prompt to look like this:
 
  [root@firewall /usr/sbin]#   --- where /usr/sbin is a current working directory
 
 I use bash; so, I cannot vouch for ash:
 
 # PS1=`echo -n -e [$USER@$HOSTNAME $HOME]# `
 [root@trout /root]#

Sorry, that was incomplete.  This ia what I do:

Put this in /etc/profile:

# Set the prompt else than login
cdprompt () {
command cd $@
export PS1=`echo -n -e \n$USER@$HOSTNAME:$PWD\n# `
}
alias cd=cdprompt

Then, I put this in ~/.profile:

 export PS1=`echo -n -e \n$USER@$HOSTNAME:$HOME\n# `

Obviously, you can modify those variable strings to do pretty much
anything you want to see; but, again, this is working under bash and not
ash . . .

hth

-- 

Best Regards,

mds
mds resource
888.250.3987

Dare to fix things before they break . . .

Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . .


---
This sf.net email is sponsored by:ThinkGeek
Bringing you mounds of caffeinated joy.
http://thinkgeek.com/sf

leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html



Re: [leaf-user] Bourne SHell prompt problems

2002-07-05 Thread Charles Steinkuehler

 I've tried about fifteen ways to get the prompt to look like this:

 [root@firewall /usr/sbin]#   --- where /usr/sbin is a current
working directory
to no avail.  The best I ever get is /root, which was the value of
$PWD (or output of `pwd`) at the time that the PS1 was exported.  The
following line is what I want:

 echo -n -e \n[$USER@$HOSTNAME `/bin/pwd`]# 

 At least, it works from the shell, just not within the construct of an
exported variable.  The embedded command always gets parsed upon export
of the variable rather than when the variable is called.  Any thoughts?
If not, has anyone compiled a bash package for Bering or another LEAF
variant?  Thanks, again!

If you're running ash (the default), it does *NO* dynamic processing on
the PS1  PS2 variables, so you can't (easily) get things like the PWD
to display as part of the prompt.  You can either upgrade to a shell
which does support this sort of processing of the prompt variables, or
cheat, and do it yourself with ash.

To get PWD as part of the prompt in ash, you have to intercept the cd
command (and other commands that might change your directory)...details
are available in the SF FAQ-o-matic:

http://sourceforge.net/docman/display_doc.php?docid=5178group_id=13751

Charles Steinkuehler
http://lrp.steinkuehler.net
http://c0wz.steinkuehler.net (lrp.c0wz.com mirror)



---
This sf.net email is sponsored by:ThinkGeek
Bringing you mounds of caffeinated joy.
http://thinkgeek.com/sf

leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html