• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Getting prompt to "expand" symbolic links?

scootermaster

Platinum Member
So, I have some links on my unix install, and my .bashrc has something like this that I lifted from the Internet:


function fastprompt()
{
unset PROMPT_COMMAND
case $TERM in
*term | rxvt )
# PS1="${HILIT}[\h:$NC\w] \[\033]0;\${TERM} [\u@\h] \w\007\]" ;;
PS1='[\u $(pwd)] ';;

linux )
PS1="${HILIT}[\h:$NC \w] " ;;
*)
PS1="[\h:\w] " ;;
esac
}

The problem is, my prompt then gets things like [server: /home/Link To Directory/here] which isn't great when your whole Linux install is actually a VMWare machine, and what you're linking to is a Dropbox directory on your host directory. I also [mistakenly] had dropbox running on the VMware image, and I literally had to put "FINDME" files in various directories to figure out where the hell I was and to figure out what was dropbox syncing with what.

Anyway, that stupidity has been fixed, but I'd still like my prompt to show the real path. I have a solution for a "real" Linux box, but that's using .csh is a lot clunkier than
\w and I don't know how to port it to bash (it involves setting a variable every time you call "cd", and then displaying that in the prompt, I think or something).

Any ideas?
 
Add this in. 1st is my favorite tool. My history is appended one every single command. So if i lose power or somehow kick out of the box without a proper exit i dont lose command history. Also when you run say 7 screen sessions the history is shared this way.

Second i just added PWD=`pwd -P` to the front of my PROMPT_COMMAND. I believe some scripts rely on $PWD for running directories. Not quite sure if this will break things. If you run into issues. Comment it out.

Also
Code:
source ~/.bashrc
will reload your settings
Code:
shopt -s histappend
PROMPT_COMMAND='PWD=`pwd -P`;echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'
PROMPT_COMMAND="$PROMPT_COMMAND;history -a"
 
Back
Top