Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Dec 1998 16:09:27 +0000
From:      Ben Smithurst <ben@scientia.demon.co.uk>
To:        Markus <mennis@ucsd.edu>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: prompt2
Message-ID:  <19981208160927.A30957@scientia.demon.co.uk>
In-Reply-To: <366C3D88.7C67F93E@ucsd.edu>
References:  <366C3D88.7C67F93E@ucsd.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Markus wrote:

> I've searched hi and low but cannot find any info regarding the prompt
> shell variable.  I've been attempting to set my prompt as the current
> working directory such as:
> 
> /usr/home/marke>%
> 
> and have it change when the directory is changed.  I was going to do an
> alias for cd and maybe change the prompt variable or use the second
> prompt variable if I knew how to print it as well but couldn't find the
> cd executable, I believe it's a system call???

It's not a system call, `cd' is a command builtin to the shell. (It has
to be, external commands don't make any effect on your current shell.)

> and couldn't find info
> on prompt2.   Do you know how to do this??

What shell? In sh, the variable you need is PS1, though it's not easy to
do what you want. If you like sh-type shells, take a look at bash in the
ports collection (shells/bash2), you can then use something like

PS1='\w>% '

to get what you want. It may be possible in csh, or tcsh which is
another csh-like shell I believe, though I don't know much about them as
I prefer sh or bash.

There is a section in one of the Unix FAQs (see comp.answers) on how to
do this as well, which might be worth a look.

-- 
Ben Smithurst
ben@scientia.demon.co.uk

send a blank message to ben+pgp@scientia.demon.co.uk for PGP key

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19981208160927.A30957>