Author Topic: Change Default "root :-)" Prompt In Pdaxii13  (Read 2528 times)

QuantumII

  • Newbie
  • *
  • Posts: 5
    • View Profile
Change Default "root :-)" Prompt In Pdaxii13
« on: January 14, 2008, 05:15:44 am »
Hi

I was just wondering how I can change the default root :-) prompt to something like root@zaurus#: ?

it's just a variable somewhere,right ?

Thank you in advance

Capn_Fish

  • Hero Member
  • *****
  • Posts: 2342
    • View Profile
    • http://
Change Default "root :-)" Prompt In Pdaxii13
« Reply #1 on: January 14, 2008, 07:32:45 am »
It's in /etc/profile, IIRC. Threre should be a line like

Code: [Select]
export PS1="root:-)"
that you would change to

Code: [Select]
export PS1= "'$(whoami)'@'$(pwd)'"
That may have a bug or two in it, but the basic format is the same.
« Last Edit: January 14, 2008, 07:35:22 am by Capn_Fish »
SL-C750- pdaXrom beta 1 (mostly unused)
Current distro: Gentoo

QuantumII

  • Newbie
  • *
  • Posts: 5
    • View Profile
Change Default "root :-)" Prompt In Pdaxii13
« Reply #2 on: January 14, 2008, 08:03:29 am »
Thank you  How can I change the #: to become $: when I'm a normal user ?

Capn_Fish

  • Hero Member
  • *****
  • Posts: 2342
    • View Profile
    • http://
Change Default "root :-)" Prompt In Pdaxii13
« Reply #3 on: January 14, 2008, 02:28:55 pm »
Probably add something like this:


Code: [Select]
if [ "`id -u`" -eq 0 ]; then
  export PS1='\u@\h:\w\# '
else
  export PS1='\u@\h:\w\$ '
fi

That's adapted from the /etc/profile on my Debian box, so it ought to be good.

EDIT: That assumes your shell is bash. If not, it likely won't work, and you'll have to adapt the one above using this format.
« Last Edit: January 14, 2008, 02:29:50 pm by Capn_Fish »
SL-C750- pdaXrom beta 1 (mostly unused)
Current distro: Gentoo

QuantumII

  • Newbie
  • *
  • Posts: 5
    • View Profile
Change Default "root :-)" Prompt In Pdaxii13
« Reply #4 on: January 14, 2008, 03:28:27 pm »
Thanks again  I was thinking about using IF , but I was unsure on the correct way to do it.

Capn_Fish

  • Hero Member
  • *****
  • Posts: 2342
    • View Profile
    • http://
Change Default "root :-)" Prompt In Pdaxii13
« Reply #5 on: January 14, 2008, 03:41:13 pm »
No problem.
I wasn't sure how to do it either, so I looked it up. Shell scripting isn't my strong suit.
SL-C750- pdaXrom beta 1 (mostly unused)
Current distro: Gentoo