Fake the version number of a binary

73 Views Asked by At

I'm trying to get fzf to work in vim on a Debian buster distro. The version of fzf in Debian buster is 0.17 but the Vim package fzf.vim requires 0.24

A temporary workaround for this was suggested at https://github.com/junegunn/fzf.vim/issues/1150#issuecomment-718694488 where if the version of fzf is called then using the below script it returns 0.24 instead

#!/bin/bash

if [[ "$1" == "--version" ]]; then
    echo "0.24.0"
else
    /usr/bin/fzf "$@"
fi

So I added the above script to a file fzf in the user home directory

polar@localhost:~$ ls
fzf

Then I added fzf to path so I have

polar@localhost:~$ echo $PATH
/home/polar/fzf:/home/polar/.pyenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

However if I run fzf --version then it still returns 0.17.5?

1

There are 1 best solutions below

0
On

Seems like I didn't have execute permissions on the file, working now with

-rwxr-xr-x 1 polar polar 96 Jul 2 10:07 fzf