>ls -alt
lrwxrwxrwx 1 root root 67 Aug 3 10:49 myFile.txt -> /some/where/else/myFile.txt
我想 cd 到
/some/where/else/
通过输入类似
follow myFile.txt
Unix 有类似的东西吗?
答案1
你可以定义一个函数:
follow () { cd $(dirname $(readlink -e "$1")); }
>ls -alt
lrwxrwxrwx 1 root root 67 Aug 3 10:49 myFile.txt -> /some/where/else/myFile.txt
我想 cd 到
/some/where/else/
通过输入类似
follow myFile.txt
Unix 有类似的东西吗?
你可以定义一个函数:
follow () { cd $(dirname $(readlink -e "$1")); }