See following example with bash-4.3.11:
[STEP 101] $ mkdir -p "foo's dir/dir1/dir2"
[STEP 102] $ complete -d cd
[STEP 103] $ cd
[STEP 103] $ cd foo\'s\ dir/
The 1st worked fine but the 2nd failed to work. Bash 4.2.47 and 4.1.9
behaved the same.
-clark
This might suffice for the initial situation, as long as the expansion is
passed in with single quotes:
function check_n_run() {
greo="$1"; wild="$2"
if $(which "$greo" > /dev/null); then
$greo $wild;
fi
}
This is too cute to be useful, but it was enjoyable seeing the unintend