0

I'm really going crazy with this simple problem. I just copy-pasted for one hour and nothing works. I'm using GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)

I just need to indicate two paths in two different variables, so later I can compare the files they are pointing at. I tried:

#!/bin/bash
unset PATH_A
unset PATH_B

PATH_A= "./assets/myTargetFile.ts"
PATH_B= "../main/assets/myTargetFile.ts"

diff -q "$PATH_A" "$PATH_B" 1>/dev/null
if [[ $? == "0" ]]
then
  echo "The same"
else
  echo "Not the same"
fi

But I'm getting those errors:

  • line 5: declare: `./assets/myTargetFile.ts': not a valid identifier
  • If I remove "declare", I get: "line 5: ./assets/myTargetFile.ts: Permission denied"

Any idea?

gal007
  • 6,911
  • 8
  • 47
  • 70
  • 1
    Got me in the beginning as well.. As SiKing says.. remove the spaces after '=' – FloLie Dec 29 '20 at 16:50
  • 1
    Check the syntax on [https://www.shellcheck.net/](https://www.shellcheck.net/), you'll see that there's a space between the `=` just as @SiKing suggested. – 0stone0 Dec 29 '20 at 16:51

0 Answers0