How Linux quickly switches to a directory

Source: Internet
Author: User

Often use the CD command to switch directories, although there are CDs-, historical directory pop push operation, after all, not intuitive. Directly on the code and deployment:

I=1here= ' pwd ' valid_here=${here//\//\\\/}already_exist= ' grep ^${here}$ $1 ' declare -a  godirswhile true; do  [[ $2 =  "a"  ]] && [[ x${ already_exist} =  "x"  ]] && sed -i  "/^eof/i\\${here}"  $1    [[ $2 =  "A"  ]] && break  [[ $2 =  "D " ]] && [[ x${ALREADY_EXIST} != " x " ]] && sed  -i  "/^${valid_here}$/d"  $1  [[ $2 =  "D"  ]] &&  break  while true ; do    read line         if [ $? -ne 0 ] ; then         break    fi    [[ -d  $line  ]]  | |  continue    echo -e  "\033[' expr 35 +  $i  % 3 ' m"   $i:  $line     godirs[$i]= $line     let i= $i +1  done <<- eof/usr/localeof# ===== end of here-document =====echo -e  "\033[0m" Echo  -n  ' where to go?  ' read -n1 -t30 necho[[ x${godirs[${n}]} !=   "X"  ]] && cd ${godirs[${n}]}breakdone


Put this file in a directory, such as/path/ff

Add a row in ~/.BASHRC

Alias Ff= '. /path/ff Path/ff '

You can use it to log out again.

Here's how to use it:

# ff# FF a# FF D

Switch directories, add directory indexes, delete directory indexes, respectively






This article is from the "architecture Enthusiast-Growth" blog, please be sure to keep this source http://39372240.blog.51cto.com/2734479/1431628

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.