1

SO i have a Bash Script like this and goal is to determine the path of an executable file and i want to print it, here is what i'm doing

#!/bin/bash

exepath=which exe

echo "$exepath"

Now this instead of printing path its starting the exe file in my system, how do i print the path stored in exepath variable.

4

1 Answer 1

2

Instead of

exepath=which exe

(this command just runs exe, previously setting the environment variable exepath to literal value which)

you should use

exepath=`which exe`

or

exepath=$(which exe)
1

Not the answer you're looking for? Browse other questions tagged .