Skip to content

Conversation

@syjung6967
Copy link

  • Specify shell as bash
  • Check python version using -V option

@@ -1,3 +1,5 @@
#!/usr/bin/env bash
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you restrict the shell to bash?
It will cause error on systems without bash.
There are also various shells such as dochsh, dash, rbash, rsh...

# any later version.

# check valid Python in order: user-specified, python, python3 and 2 #
PYTHON=`which $PYTHON || which python || which python3 || which python2`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks nice! :)


# check valid Python in order: user-specified, python, python3 and 2 #
PYTHON=`which $PYTHON || which python || which python3 || which python2`
if [ z`$PYTHON -V 2>/dev/null | cut -d' ' -f1` != "zPython" ]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using regular expressions instead of external commands like cut?

@iipeace iipeace force-pushed the master branch 6 times, most recently from a53d579 to 71e37f9 Compare July 27, 2021 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants