linux 跳转路径,linux路径跳转小工具

- Prints the directory associated with "bookmark_name"' echo 'd

- Deletes the bookmark' echo 'l - Lists all available bookmarks' kill -SIGINT $$ fi } # list bookmarks with dirnam function l { check_help $1 source $SDIRS # if color output is not working for you, comment out the line below '\033[1;32m' == "red" env | sort | awk '/^DIR_.+/{split(substr($0,5),parts,"="); printf("\033[0;33m%-20s\033[0m %s\n", parts[1], parts[2]);}' # uncomment this line if color output is not working with the line above # env | grep "^DIR_" | cut -c5- | sort |grep "^.*=" } # list bookmarks without dirname function _l { source $SDIRS env | grep "^DIR_" | cut -c5- | sort | grep "^.*=" | cut -f1 -d "=" } # validate bookmark name function _bookmark_name_valid { exit_message="" if [ -z $1 ]; then exit_message="bookmark name required" echo $exit_message elif [ "$1" != "$(echo $1 | sed 's/[^A-Za-z0-9_]//g')" ]; then exit_message="bookmark name is not valid" echo $exit_message fi } # completion command function _comp { local curw COMPREPLY=() curw=${COMP_WORDS[COMP_CWORD]} COMPREPLY=($(compgen -W '`_l`' -- $curw)) return 0 } # ZSH completion command function _compzsh { reply=($(_l)) } # safe delete line from sdirs function _purge_line { if [ -s "$1" ]; then # safely create a temp file t=$(mktemp -t bashmarks.XXXXXX) || exit 1 trap "/bin/rm -f -- '$t'" EXIT # purge line sed "/$2/d" "$1" > "$t" /bin/mv "$t" "$1" # cleanup temp file /bin/rm -f -- "$t" trap - EXIT fi } # bind completion command for g,p,d to _comp if [ $ZSH_VERSION ]; then compctl -K _compzsh g compctl -K _compzsh p compctl -K _compzsh d else shopt -s progcomp complete -F _comp g complete -F _comp p complete -F _comp d fi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值