User Tools

Site Tools


resources:bash_resources

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
resources:bash_resources [2015/06/24 11:02] – created anthonyresources:bash_resources [2019/05/22 16:08] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== bash Resources ======
 +
 +\\
 +
 ====== bash variables ====== ====== bash variables ======
  
Line 11: Line 15:
 </code> </code>
  
 +\\
 +----
 +
 +====== bash command prompt customization ======
 +
 +<2016-01-27>
 +
 +===== Show cwd basename, not entire absolute path =====
 +
 +First, back up the copy of ''.bashrc'' that came with Ubuntu:
 +
 +<code bash>
 +anthony@anthony-VirtualBox:~$ cp -p .bashrc .bashrc.orig
 +</code>
 +
 +Changed ''\w'' (absolute path, I think) to ''\W'' ("basename", just the single directory name):
 +
 +<code bash>
 +if [ "$color_prompt" = yes ]; then
 +    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
 +else
 +# orig. line:
 +#    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
 +# adc changed 2016.01.27:
 +    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$ '
 +fi
 +</code>
 +
 +Based on advice from:
 +
 +http://askubuntu.com/questions/16728/hide-current-working-directory-in-terminal
  
 +http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
  
  
 +\\
 +----
resources/bash_resources.1435158157.txt.gz · Last modified: (external edit)