xxxxxxxxxx
macOS:
Open Visual Studio Code.
Press Cmd + Shift + P to open the command palette.
Type shell command in the search box and select Install 'code' command in PATH from the dropdown.
After doing this, the code command should be available from the terminal. You can verify this by opening a terminal and typing:
If it returns the version of VS Code, then it's successfully added to your PATH and you can run the modified script without any issues.