0

Currently, I have the zathura program installed in my system. What I did is writing a bash scripts redefine and program to have the right output. I also updated the $PATH for the scripts. However. when I run zathura command on the terminal it behave the same as the original zathura program, which is openning up a pdf file and stopping me from interacting with the terminal. I want zathura command to open a pdf file without taking me away from the terminal.

This is the content of the script:

#!/bin/bash
command zathura "$1" &> /dev/null &

the input will be pdf file. For example, zathura quickstart.pdf should open a pdf file and keep me interact with the terminal sitll.

Additionally, These are the output of which command echo $PATH command :

which zathura
/home/anpham/scripts/zathura

echo $PATH
/home/anpham/scripts:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
  • @roaima thanks for the echo debug trig. I typed in the hash -r command. I also get in in the hash table. But now the script doesn't open the pdf file. – vincent pham Nov 04 '19 at 23:04
  • I know what's wrong. I should add the absolute path for the original zathura command. – vincent pham Nov 04 '19 at 23:08

1 Answers1

1

Your script is missing its #! line. I would also suggest you put a debugging line immediately underneath it so you can prove to yourself you're actually running your script.

The resultant script would therefore be something like this

#!/bin/bash
echo "This is my script - with '$1'"
/usr/bin/zathura "$1" &> /dev/null &

Your $PATH is correct, so if you find you aren't running your script, make sure you've told bash you've overlaid the original zathura by typing hash -r .

Chris Davies
  • 116,213
  • 16
  • 160
  • 287
  • With the PATH that he has, wouldn't this just call the script again if the script is also called zathura? I believe it would be better with a shell function (it's such a small thing). – Kusalananda Nov 04 '19 at 23:04
  • @Kusalananda almost certainly, but I was trying also to illustrate how one might go about tracking down the perceived problem. The OP also provided an edit (thank you) to fix the system standard path for the tool. – Chris Davies Nov 05 '19 at 00:08