0

I have the following script.

python3_path = $(which python3)
echo "Python 3 path: "
echo $python3_path

and I'm getting the following error:

./seed.sh: line 123: python3_path: command not found
Python 3 path: 

I'm not sure why python3_path is empty here.

user1187968
  • 5,950
  • 15
  • 62
  • 136

1 Answers1

2

bash is finicky. Do not put spaces around = when assigning variables.

Try this instead:

python3_path=$(which python3)
echo "Python 3 path: "
echo $python3_path

or you could also do it this way:

python3_path=$(which python3)
echo "Python 3 path: $python3_path"

or this way is even shorter:

echo "Python 3 path: $(which python3)"
erapert
  • 1,343
  • 12
  • 15