diff --git a/just_sh/convert.py b/just_sh/convert.py index c7d1d8e..becc675 100644 --- a/just_sh/convert.py +++ b/just_sh/convert.py @@ -268,7 +268,7 @@ def expression_to_string(expression: ExpressionType, depth: int = 0) -> str: } """, "sha256_file": r"""sha256_file() { - if type sha256sum > /dev/null; then + if type sha256sum > /dev/null 2>&1; then sha256sum --binary "${1}" | cut -d ' ' -f 1 elif type python3 > /dev/null 2>&1; then python3 -c 'from hashlib import sha256; import sys; print(sha256(sys.stdin.buffer.read()).hexdigest())' \ @@ -283,7 +283,7 @@ def expression_to_string(expression: ExpressionType, depth: int = 0) -> str: } """, "sha256": r"""sha256() { - if type sha256sum > /dev/null; then + if type sha256sum > /dev/null 2>&1; then printf "%s" "${1}" | sha256sum --binary | cut -d ' ' -f 1 elif type python3 > /dev/null 2>&1; then printf "%s" "${1}" | \