Describe your question
I maintain a Bash script which sets up my shell configurations, useful when working on a new server for the first time.
I recently added fzf-tab to this script, which I execute like this:
One of the things the script attempts to install is fzf-tab, as per the following excerpt:
ZSH_CUSTOM="/<redacted>/oh-my-zsh/custom"
FZF_TAB="${ZSH_CUSTOM}/plugins/fzf-tab"
if [[ ! -d "${FZF_TAB}" ]]; then
git clone https://github.com/Aloxaf/fzf-tab "${FZF_TAB}"
source "${FZF_TAB}/fzf-tab.zsh" && build-fzf-tab-module
fi
However, when the script gets to that block, it shows errors stemming from your module:
Cloning into '/<redacted>/oh-my-zsh/custom/plugins/fzf-tab'...
/<redacted>/oh-my-zsh/custom/plugins/fzf-tab/fzf-tab.zsh: line 2: local: can only be used in a function
/<redacted>/oh-my-zsh/custom/plugins/fzf-tab/fzf-tab.zsh: line 6: builtin: setopt: not a shell builtin
/<redacted>/oh-my-zsh/custom/plugins/fzf-tab/fzf-tab.zsh: line 24: syntax error near unexpected token `)'
/<redacted>/oh-my-zsh/custom/plugins/fzf-tab/fzf-tab.zsh: line 24: ` || ({ -ftb-zstyle -m disabled-on "files" } && [[ -n $isfile ]]); then'
Passing the -x flag into the script and rerunning generates the following slightly more informative output:
Cloning into '/<redacted>/oh-my-zsh/custom/plugins/fzf-tab'...
+ source /<redacted>/oh-my-zsh/custom/plugins/fzf-tab/fzf-tab.zsh
++ builtin local -a _ftb_opts
/<redacted>/oh-my-zsh/custom/plugins/fzf-tab/fzf-tab.zsh: line 2: local: can only be used in a function
++ [[ ! -o aliases ]]
++ [[ ! -o sh_glob ]]
++ [[ ! -o no_brace_expand ]]
++ builtin setopt no_aliases no_sh_glob brace_expand
/<redacted>/oh-my-zsh/custom/plugins/fzf-tab/fzf-tab.zsh: line 6: builtin: setopt: not a shell builtin
/<redacted>/oh-my-zsh/custom/plugins/fzf-tab/fzf-tab.zsh: line 24: syntax error near unexpected token `)'
/<redacted>/oh-my-zsh/custom/plugins/fzf-tab/fzf-tab.zsh: line 24: ` || ({ -ftb-zstyle -m disabled-on "files" } && [[ -n $isfile ]]); then'
Strangely and importantly, when I source that file interactively - so manually, not inside a script - it seems to run just fine.
Any idea what the issue might be?
For context, all code and outputs above were obtained from the master branch, commit c2b4aa5ad2532cca91f23908ac7f00efb7ff09c9.
Describe your question I maintain a Bash script which sets up my shell configurations, useful when working on a new server for the first time.
I recently added
fzf-tab
to this script, which I execute like this:One of the things the script attempts to install is
fzf-tab
, as per the following excerpt:However, when the script gets to that block, it shows errors stemming from your module:
Passing the
-x
flag into the script and rerunning generates the following slightly more informative output:Strangely and importantly, when I source that file interactively - so manually, not inside a script - it seems to run just fine.
Any idea what the issue might be?
For context, all code and outputs above were obtained from the
master
branch, commitc2b4aa5ad2532cca91f23908ac7f00efb7ff09c9
.