When a file is saved with BOM (byte-order mark) on a Mac or Linux machine Windows PowerShell cannot execute the script.
Unfortunately the “cat” command does not show the byte-order mark at the beginning of the file. Some editors show a question mark at the beginning of the file.
I have discovered it when I issued the “git diff” command:
To remove the BOM in Visual Studio Code
- Open the file in Visual Studio Code
- Click the UTF-8 with BOM text at the bottom right of the screen
- On the top select Save with Encoding
- Select UTF-8
The “git diff” command shows the removal of the BOM