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.

1 Answers1

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)
raj
  • 1,123
  • 4
  • 11