sh(1) man page suggestion: prompt string syntax

Mike Brown mike at skew.org
Sat Jul 4 05:37:20 UTC 2015


I was having trouble finding out what escape codes are valid in an sh(1) 
prompt. The man page does not say, so I looked at /usr/src/bin/sh/parser.c and 
determined what the options are. Please consider adding this info to the man 
page, /usr/src/bin/sh/sh.1 :


A prompt string must be less than 128 characters. All characters are output 
verbatim, except these sequences:

'$' is replaced with '#' if the user is root.
'\h' is replaced with the local hostname.
'\H' is replaced with the fully-qualified hostname.
'\W' is replaced with the working directory.
'\w' is replaced with the full path of the working directory.



More information about the freebsd-doc mailing list