comp426-2022-fall / a02

Create a command line Node.js package that ingests API data from Open-Meteo
GNU Affero General Public License v3.0
0 stars 0 forks source link

Runtime error: [BRIEF DESCRIPTION OF THE ERROR] #7

Closed jpurvis2 closed 1 year ago

jpurvis2 commented 1 year ago

What is happening?

Trying to run galso.sh file

"galo.sh % sh galo.sh -n 35 -e 35 -z" "sh galo.sh -v -n 35 -e 35 -z"

and I am just getting "no options"

What does the error say is happening?

jordanpurvis@MacBook-Pro-97 galo.sh % sh galo.sh -n 35 -e 35 -z no options jordanpurvis@MacBook-Pro-97 galo.sh % sh galo.sh -v -n 35 -e 35 -z no options jordanpurvis@MacBook-Pro-97 galo.sh % ./galo.sh -v -n 35 -e 35 -z no options jordanpurvis@MacBook-Pro-97 galo.sh % ./galo.sh -v -n35 -e35 -z no options jordanpurvis@MacBook-Pro-97 galo.sh % ./galo.sh -v -n35 -e35 -z no options jordanpurvis@MacBook-Pro-97 galo.sh % ./galo.sh -v -n35 -e35 -z no options jordanpurvis@MacBook-Pro-97 galo.sh % bash-galo.sh -v -n35 -e35 -z

jdmar3 commented 1 year ago

As we talked about after class today, this looks like it is related to the shell that is running, and even if you run it with sh or bash and even though there is a shebang in the script file, it seems not to want to run in ZSH.

So, you have a few options.

  1. You can run bash in your ZSH and it will open a bash environment that you can then use to run Bash scripts.
  2. You can open a Bash shell terminal in VSCode. You would do this by clicking on the little down arrow next to the plus sign in the terminal tab interface and select "bash": Screenshot VSCode terminal select bash
  3. You can change the default shell in VSCode to Bash. Open File > Preferences > Settings and then search for "terminal default profile". It should let you change the terminal default profile there via dropdown for your operating system. Otherwise you can edit the JSON to set it. Screenshot from 2022-10-06 11-04-28
  4. Change the default shell for your system: https://www.cyberciti.biz/faq/how-to-change-shell-to-bash/

I'm not sure why MacOS doesn't want to run that file in ZSH, even with the shebang and even if you are specifically invoking another shell to run it, but the above provide some workarounds.