On Aug 30, 2009, at 8:04 PM, Shawn Walker wrote:

~/.bashrc that defines prompt as

#
# Define default prompt to <username>@<hostname>:<path><"($|#) ">
# and print '#' for user "root" and '$' for normal users.
#
PS1='${logna...@$(/usr/bin/hostname):$(
[[ "${LOGNAME}" == "root" ]] && printf "%s" "${PWD/${HOME}/~}# " ||
  printf "%s" "${PWD/${HOME}/~}\$ ")'


Is there any reason why it cannot be just

PS1="\...@\h:\w\$ "

?

haha - yep, one of the first things i change .. my guess is it that it's left over from either an old bourne shell compatibility or perhaps from the great ksh93 debate .. (of course this also is a bit chatty if you boot into a miniroot since /usr/bin/hostname doesn't exist) .. feel free to webrev patch it - particularly for bash if you've got the inclination :)

Personally, I prefer the new prompt. And if I recall correctly, this was an intentional change that is more in line with what other distributions do.

erm - i think that should be with single quotes as the point is that the 2 do the exact same thing (see PROMPTING in the bash man page) - it's just that:
PS1='\...@\h:\w\$ '

is more compact and cleaner for a .bashrc (which i presume is only going to be used by bash) .. and it also doesn't call another binary every time you display the prompt

---
.je
_______________________________________________
indiana-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/indiana-discuss

Reply via email to