Ben Chuanlong Du's Blog

It is never too late to learn.

Calling Shell from Python

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

  1. subprocess.run is preferred to the function os.system for invoking shell commands. For more discussions, pleaser refer to [Hands on the Python module subprocess]https://www.legendu.net/en/blog …

Parallel Computing in Shell

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

  1. & and wait

  2. parallel

  3. xargs

parallel is a cool bash command which makes parallel computing easy in Bash. It is a parallel version replacement of xargs.

Preferred Python Version in Shebang

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

#!/bin/sh
''''which python2 >/dev/null 2>&1 && exec python2 "$0" "$@" # '''
''''which python  >/dev/null 2>&1 && exec python  "$0" "$@" # '''
''''exec echo "Error: I can't find python anywhere"         # '''

Reference

https …