Yep, the code you provided is compiled into this:
command_0="$(cat file.txt | grep "READY")"
__status=$?
if [ "${__status}" != 0 ]; then
echo "Failed to read the file"
fi
So, the outcome would depend on the pipefail option. (set -o pipefail)
As you suggested, an Amberic snippet would be:
import { file_read } from "std/fs"
import { match_regex } from "std/text"
const result = file_read("file.txt") failed {
echo "Failed to read the file"
}
if match_regex(result, "READY"):
echo "file.txt contains READY"