-1

I have a very simple script that benchmark apps using the Vulkan API. it takes an argument from $1:

benchmark-app:

#!/usr/bin/env bash

VK_INSTANCE_LAYERS=VK_LAYER_MESA_overlay VK_LAYER_MESA_OVERLAY_CONFIG=position=top-right $1

To use it, I run benchmark-app example-game. It will take the argument and execute as expected, but when using tab completion it looks in ./ not $PATH.

  • He... ? Your script runs under your user I presume? So it should have the same env. variables as you do when you login. If your user can run `$1`, it should be ok from your script. **1** does it work with the full path to the command you put in `$1`? **2** Debug: add `which "$1"` as the first line of your script. It should give your the proper path. If no fix that. **3** You could add `echo "$PATH"`, to see what PATH variable your script uses. Please explain better "when using tab completion", what are you trying *exactly*. – Nic3500 Sep 21 '20 at 01:48
  • @Nic3500 What I want is to be able to type `benchmark-app exa`, then press Tab on the keyboard and have it complete to `benchmark-app example-game`. `benchmark-app /usr/bin/exa`, then pressing Tab works. `benchmark-app example-game` also works, but the argument has to be typed word for word. – Gareth Anthony Hulse Sep 21 '20 at 10:33
  • 1
    That might help https://stackoverflow.com/questions/3690655/auto-complete-command-line-arguments or this https://tldp.org/LDP/abs/html/tabexpansion.html – Nic3500 Sep 21 '20 at 16:59

1 Answers1

0

I got tab completion working using GNU's complete command. I created the file /etc/bash_completion.d/benchmark-app and added this line: complete -F _command benchmark-app.