yungyuc/nsd

Question about the meaning of Exercise2,3

Closed this issue · 2 comments

I'm solved the exercise2 and 3, but not sure my direction is correct.

  1. Port "step0.py" to use bash.
  2. Modify the script "step0.py" so that it reads the environment variable named "PYTHON_BIN" that specifies the location of the Python executable for the script. Hint: play a trick using bash.

Does the exercise2 ask us to translate the python script into bash script ?

And the execution flow of exercise3 is

  • export PYTHON_BIN=...
  • ./step0.py
  • Interpret step0.py as the language of PYTHON_BIN

Or can you give a more detail explanations about the exercise2 and 3 ?

For exercise 2, your understanding is correct.

For exercise 3, the flow is generally correct. But PYTHON_BIN points to a Python interpreter. As I explained in the classroom, you may assume that the user has more than one interpreter, say, python_a and python_b. The environment variable is used to pick either of the executable for running the Python script. Note, PYTHON_BIN should always point to a Python interpreter. "The language of PYTHON_BIN" should always be Python.

Ah ~ I've got it! Thanks for your explanation.