bash: complete: -I: invalid option

Опубликовано: 19 Июнь 2026
на канале: Emrah KAYA
5
1

Hello everyone! I hope this video has helped solve your questions and issues. This video is shared because a solution has been found for the question/problem. I create videos for questions that have solutions. If you have any other issues, feel free to reach out to me on Instagram:   / ky.emrah  

Below, you can find the text related to the question/problem. In the video, the question will be presented first, followed by the answers. If the video moves too fast, feel free to pause and review the answers. If you need more detailed information, you can find the necessary sources and links at the bottom of this description. I hope this video has been helpful, and even if it doesn't directly solve your problem, it will guide you to the source of the solution. I'd appreciate it if you like the video and subscribe to my channel!Hello everyone! I hope this video has helped solve your questions and issues. This video is shared because a solution has been found for the question/problem. I create videos for questions that have solutions. If you have any other issues, feel free to reach out to me on Instagram:   / ky.emrah  

Below, you can find the text related to the question/problem. In the video, the question will be presented first, followed by the answers. If the video moves too fast, feel free to pause and review the answers. If you need more detailed information, you can find the necessary sources and links at the bottom of this description. I hope this video has been helpful, and even if it doesn't directly solve your problem, it will guide you to the source of the solution. I'd appreciate it if you like the video and subscribe to my channel!bash: complete: -I: invalid option

I'm using the bash complete -I option as follows:
__cmp_exec() {
local curr="$2"
case "$curr" in
./*)
local selected=$(find "." ! -type d -executable | fzf --query "$curr")
if [[ -n "$selected" ]]; then
COMPREPLY=( "$selected" )
else
COMPREPLY=()
fi
esac
}


complete -I -F __cmp_exec -o bashdefault

__cmp_exec() {
local curr="$2"
case "$curr" in
./*)
local selected=$(find "." ! -type d -executable | fzf --query "$curr")
if [[ -n "$selected" ]]; then
COMPREPLY=( "$selected" )
else
COMPREPLY=()
fi
esac
}


complete -I -F __cmp_exec -o bashdefault

Locally everything works. But when I use the script on our server I get an error:
bash: complete: -I: invalid option

bash: complete: -I: invalid option

This is the bash version I'm running:
$ bash --version
bash --version
GNU bash, version 4.4.20(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
history -a

$ bash --version
bash --version
GNU bash, version 4.4.20(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
history -a

I thought bash supports the -I flag from version 4.0, am I wrong in assuming so?


Tags: bash,debianSource of the question:
https://stackoverflow.com/questions/7...

Question and source license information:
https://meta.stackexchange.com/help/l...
https://stackoverflow.com/Source of the question:
https://stackoverflow.com/questions/7...

Question and source license information:
https://meta.stackexchange.com/help/l...
https://stackoverflow.com/