From 1ad53660352347aa88ff5ec15bda544f56eaae2c Mon Sep 17 00:00:00 2001 From: ianmacd <> Date: Wed, 23 Jan 2002 23:36:30 +0000 Subject: [PATCH] renamed _file_and_dir() _filedir_xspec() created _filedir(), which is used by cat, less, more, ln and strip, so that tilde expansion can be performed, prior to pathname expansion --- bash_completion | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/bash_completion b/bash_completion index 56e77b10..3bc14f37 100644 --- a/bash_completion +++ b/bash_completion @@ -2,7 +2,7 @@ # # # @@ -37,9 +37,6 @@ shopt -s extglob progcomp # Make directory commands see only directories complete -d mkdir rmdir pushd -# Make file commands see only files -complete -f cat less more ln strip - # the following section lists completions that are redefined later # START exclude -- do NOT remove this line #complete -f -X '*.bz2' bzip2 @@ -1611,7 +1608,21 @@ _configure_func () } complete -F _configure_func configure -_file_and_dir() +_filedir() +{ + local IFS cur + + IFS=$'\t\n' + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + + _expand || return 0 + + COMPREPLY=( $( eval compgen -f $cur ) $( compgen -d $cur ) ) +} +complete -F _filedir -o filenames cat less more ln strip + +_filedir_xspec() { local IFS cur xspec @@ -1649,7 +1660,7 @@ list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' \ if [ ${#list[@]} -gt 0 ]; then eval complete -r ${list[@]} # install new compspecs - eval complete -F _file_and_dir -o filenames ${list[@]} + eval complete -F _filedir_xspec -o filenames ${list[@]} fi unset list[@]