help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Filename completion containing slashs


From: reportbug
Subject: [Help-bash] Filename completion containing slashs
Date: Sat, 3 Jan 2015 21:41:12 +0100

Hi,

if I execute the completion script below and enter "foo <tab>", bash prints
only "dir" instead of "but/dir".

If I don't use "-o filenames" then bash prints "but/dir". But then "foo e<tab>"
doesn't gives the space char escaped anymore.

Is there a way to accomplish both, full path completion and escaping?

Not sure where this behavior comes from (readline or bash).

Thanks and best regards,
John

_foo()
{
  local cur=${COMP_WORDS[COMP_CWORD]}
  case "$cur" in
    w*)
      COMPREPLY=( 'we/complete/with/slash' )
      ;;
    e*)
      COMPREPLY=( 'escape works' )
    ;;
    *)
      COMPREPLY=( 'but/dir' 'not shown' )
      ;;
  esac
}
complete -o filenames -F _foo foo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]