Meaningful PS1 on Bourne shells [was: Re: zfs newbie]

David Christensen dpchrist at holgerdanske.com
Wed Sep 15 19:28:00 UTC 2021


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 at dipsy ~
$ grep PS1 .profile
export PS1='\n\D{%Y-%m-%d %H:%M:%S} '${USER}'@\h \w\n\$ '


David


More information about the freebsd-questions mailing list