The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

FreeBSD Support
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 Freebsd bash shell
Author: Maziar A. 
Date:   17-12-01 18:56

Hi everyone,

I just installed bash-2.05 on FreeBSD 4.4. My question is how would be able to add the current user and the current directory to the shell prompt?

For example my FreeBSD reads
bash-2.05#


Yet my Redhad linux reads
[maz00@mylinux1 local]$


Thank you
Maziar A.

Reply To This Message
 
 Re: Freebsd bash shell
Author: Daniel Schrock 
Date:   17-12-01 19:15

10:13:44:d_jab@carbon: ~
>> cat /etc/profile
# $FreeBSD: src/etc/profile,v 1.12.2.1 2000/07/31 20:13:26 rwatson Exp $
#
# System-wide .profile file for sh(1).
#
# Uncomment this to give you the default 4.2 behavior, where disk
# information is shown in K-Blocks
# BLOCKSIZE=K; export BLOCKSIZE
#
# For the setting of languages and character sets please see
# login.conf(5) and in particular the charset and lang options.
# For full locales list check /usr/share/locale/*
# You should also read the setlocale(3) man page for information
# on how to achieve more precise control of locale settings.
#
# Read system messages
msgs -f
# Allow terminal messages
mesg y

alias ls='ls -FG'
alias ll='ls -lFG'
alias la='ls -laFG'
alias et='echo $TERM'
alias expc='export TERM=cons25'
alias expx='export TERM=xterm'

MIBDIRS='/usr/local/share/snmp/mibs'
MIBS=+ALL

MAIL=~/Maildir/new
export MAIL

if [ `id -u` = 0 ] ; then
PS1='\033[47m\033[31m\]\t:\u@\h: \w\[\033[40m\033[0m\]\n>> '
else
if [ `id -g` = 666 ] ; then
PS1='\033[44m\033[1;37m\]\t:\u@\h: \w\[\033[40m\033[0m\]\n>> '
else
PS1='\[\033[35m\][\t]\[\033[1;32m\][\u@\h]\[\033[35m\][\w]\[\033[35m\]\n
>> \[\033[0m\]'
fi
fi
export PS1;

if [ -x /usr/games/fortune ]; then
/usr/games/fortune
fi

Reply To This Message
 
 Re: Freebsd bash shell
Author: Dan Langille 
Date:   17-12-01 21:52

You click on search on the top left corner of this page, and search for prompt. There you'll find an article on changing your shell, which contains what you nead.

Reply To This Message
 
 Re: Freebsd bash shell
Author: parv 
Date:   18-12-01 11:11

what dan l. said and daniel s. wrote (indirectly). also, answer is easily found in bash(1). use "\w" for full directory path, "\W" for current directory only (or, basename).

to see how your prompt is set up, do this...

# printenv PS1 # works on freebsd 4.4-stable

...if above fails on linux, try this (still no guarantee)...

# env | less --pattern=PS1
# env | grep -F -2 PS1

...on linux, you get a custom prompt set up by somebody in some file. the prompt you get on freebsd is the default bash prompt (according to bash(1)).

it's all in the docs. one way or another.

Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org