A menu based bash directory browser
This could be useful when you have long pathnames to browse around and these pathnames have similar names...so CDPATH may not work.
#!/bin/bash
function cd()
{
if [ -z "$1" ]
then
pushd $HOME
return 0
fi
THEDIR=$(echo $1|sed -e "s/\~/$(echo $HOME|sed -e 's/\//\\\//g')/g")
pushd $THEDIR >/dev/null 2>&1
}
function lsd()
{
if [ -z "$1" ]
then
select mydir in $(dirs -v|awk '{print $2}'|sort -u)
do
cd $mydir
break
done
else
if [ -d "$1" ]
then
select mydir in $(find $1 -type d)
do
cd $mydir
break
done
fi
fi
}
0 Comments:
Post a Comment
<< Home