Return to Snippet

Revision: 45784
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
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