Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Sep 2021 12:27:47 -0700
From:      David Christensen <dpchrist@holgerdanske.com>
To:        freebsd-questions@freebsd.org
Subject:   Meaningful PS1 on Bourne shells [was: Re: zfs newbie]
Message-ID:  <de45a8ce-66da-b798-e857-b4ffebeeb209@holgerdanske.com>
In-Reply-To: <b76b3c9d-2743-eafc-44f4-8f8173ea2d12@holgerdanske.com>
References:  <alpine.BSF.2.00.2109071736520.87853@bucksport.safeport.com> <2b3bd0c8-204d-2f9b-2d63-cca853f5893c@langille.org> <alpine.BSF.2.00.2109141838150.65923@bucksport.safeport.com> <b76b3c9d-2743-eafc-44f4-8f8173ea2d12@holgerdanske.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 9/15/21 11:28 AM, David Christensen wrote:
> PS1=\n\D{%Y-%m-%d %H:%M:%S} dpchrist@\h \w\n\$
> 
> 
> (Looking at the value of PS1, it is curious that I hard-coded the 
> username as 'dpchrist' rather than using a '\u' special character.  I 
> have been using the same PS1 on multiple platforms and with multiple 
> Bourne-like shells for many years; one of them must have been lacking 
> this feature.)


The username is not hard-coded -- it is set from the USER environment 
variable in my Bourne shell profile:

2021-09-15 12:20:50 dpchrist@dipsy ~
$ grep PS1 .profile
export PS1='\n\D{%Y-%m-%d %H:%M:%S} '${USER}'@\h \w\n\$ '


David



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?de45a8ce-66da-b798-e857-b4ffebeeb209>