Revision: 45784
Updated Code
at June 14, 2011 19:44 by ChloeD
Updated Code
function setroot { web_root=$1 PS1='${debian_chroot:+($debian_chroot)}\u@\h:$(echo \w| sed s@'$web_root'@@g)\$ \[\033k\]$(basename "\w")\[\033\\\]' export PS1 alias ca="cd $PWD" } # this can be adapted
Revision: 45783
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 7, 2011 23:12 by ChloeD
Initial Code
function setroot { web_root=$1 PS1='${debian_chroot:+($debian_chroot)}\u@\h:$(echo \w| sed s@'$web_root'@@g)\$ \[\033k\]$(basename \w)\[\033\\\]' export PS1 alias ca="cd $PWD" } # this can be adapted
Initial URL
Initial Description
This is for debian but can be adapted with little trickery to any Linux distro. This enables changing the root of a shell so that the directories displayed are not too long. Useful for dir-verbose frameworks like symfony or when managing a huge website directory. Usage: setroot $PWD
Initial Title
Change root in a bash shell.
Initial Tags
Bash
Initial Language
Bash