Open a file from the command line

Solution 1:

Dirty workaround time: write a function into your .bashrc/ .zshrc (others might work these two are the only ones I tested) that calls realpath to get the absolute path of the input file:

function kile-open {
    kile $(realpath $1)
}

To regain the intended behavior (for one file at a time, not working with any other parameters, this can easily be improved with some bash knowledge). This is by no means a solution, just a way to mimic the intended behavior for now.

Solution 2:

Inspired by @m00am solution, in bash you can add the following to the .bashrc:

kile() { command kile $(realpath "$@") }

The command kile myfile.tex will then work. Personnally, I even redirect the output to /dev/null and release the command:

kile() { command kile $(realpath "$@") > /dev/null 2>&1 & }