User Tools

Site Tools


resources:bash_resources

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
resources:bash_resources [2016/01/27 20:47] 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 10: Line 14:
 declare -p declare -p
 </code> </code>
 +
 +\\
 +----
  
 ====== bash command prompt customization ====== ====== 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> <code bash>
Line 18: Line 30:
 </code> </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://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.1453945627.txt.gz · Last modified: (external edit)