Bash completion to make 'cd' command complete working directories from other running shells?
- 阅读更多 关于 Bash completion to make 'cd' command complete working directories from other running shells?
问题 I'm trying to write a bash completion that will let me complete directory names that other shells are in. For example, suppose I have another shell open in /very/long/path/name , and I'm currently in a directory that contains subdirs foo and bar . When I type cd <Tab> , I want to see: $ cd <Tab> foo/ bar/ /very/long/path/name I have this command to produce the list of potential completions: ps -Cbash -opid= | xargs pwdx | cut -d" " -f2 | sort -u | while read; do echo ${REPLY#$PWD/}; done |