Skip to content

zsh 5.5.1 error with fbr: bad math expression: operand expected at `" 3"' #12

@jatcwang

Description

@jatcwang

I'm getting this error on zsh 5.5.1 when trying to use fbr to change branches

Here's the fix. If you can reproduce it I'll put up the PR.

fbr() {
       --format='%(refname:short)'
   )" || return

-  num_branches="$(wc -l <<< "$branches")"
+  num_branches="$(echo $(wc -l <<< "$branches") | xargs echo -n)"

   branch="$(
     echo "$branches" \
-      | fzf-tmux -d "$((2 + "$num_branches"))" +m
+      | fzf-tmux -d "$((2 + $num_branches))" +m
   )" || return

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions