It has irritated me for some time that Bash was expanding ~ (my home directory path). For instance, if I type:

   $ ls ~/Doc <Tab>

Bash would expand the path to:

   $ ls /home/roydsd/Documents

This is a matter of personal taste, but I'd prefer the tilde to remain, thanks.

I've found the culprit in /etc/bash_completion. Find the function _expand(), and edit it as follows:

   # This function expands tildes in pathnames
   #
   _expand()
   {
       [ "$cur" != "${cur%\\}" ] && cur="$cur\\"

       # expand ~username type directory specifications
       if [[ "$cur" == \~*/* ]]; then
           #eval cur=$cur <-------- Commented out
           return # <-------- Added
elif [[ "$cur" == \~* ]]; then
           #cur=${cur#\~}  <-------- Commented out
           #COMPREPLY=( $( compgen -P '~' -u $cur ) )  <--------
   Commented out
           #return [EMAIL PROTECTED]  <-------- Commented out
           return # <-------- Added
       fi
   }

Douglas.





=======================================================================
This email, including any attachments, is only for the intended
addressee.  It is subject to copyright, is confidential and may be
the subject of legal or other privilege, none of which is waived or
lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our
apologies, notify us by return, delete all copies and perform no
other act on the email.
Unfortunately, we cannot warrant that the email has not been
altered or corrupted during transmission.
=======================================================================

Reply via email to