Closed ibahnasy closed 3 months ago
Thanks for the report, but this is the expected behavior.
This is the expected behavior as it's a known bug and will be fixed or this is normal and will last like that?
Because it's really important to use pipes and grep for system administration, otherwise I have to remove ble.sh.
It's not specific to ble.sh. In the plain Bash and also in any other shells, the exit status in this case is 1
. This is required by the POSIX standard.
Oh I see, I just was confused when it printed out the status instead of not printing anything by default, thanks.
The exit status of a pipe line is the exit status of the last command in the pipe line. In this case, it is the exit status of grep
. Then, the exit status of grep
becomes 1 if there is no matching.
Quoted from POSIX XCU 4 grep:
EXIT STATUS The following exit values shall be returned:
- 0 One or more lines were selected.
- 1 No lines were selected.
- -1 An error occurred.
Oh I see, I just was confused when it printed out the status instead of not printing anything by default, thanks.
Ah, yes. Maybe I've confused you, but ble.sh prints the exit status of the previous user command when it is not 0
. If you want to prevent ble.sh from printing any exit status, you can disable the feature by the following setting (as described in README 2.2):
# ~/.blerc
bleopt exec_errexit_mark=
ble version: 0.4.0-devel4+adf9ab8 Bash version: 5.2.15(1)-release (x86_64-pc-linux-gnu)
ble.sh exists with status 1 when running a command with pipe and grep: