[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to get the exit code of `command | getline [var]`?
From: |
Peng Yu |
Subject: |
How to get the exit code of `command | getline [var]`? |
Date: |
Sat, 16 May 2020 17:59:50 -0500 |
Hi,
There is an error below. But I can not get the error code. Is there a
way to get the error code? Thanks.
$ awk -v tmpfile="$(mktemp -u)" -e 'BEGIN { exit_code = "cat " tmpfile
| getline x; print exit_code; print x }'
cat: /tmp/mktemp/tmp.USzT4D7yJ3: No such file or directory
0
--
Regards,
Peng
- How to get the exit code of `command | getline [var]`?,
Peng Yu <=