Execute arguments as command

Runs the arguments as a command and then stores output and exit status into special global variables. It returns with status code 0 to help making assertions in your test case.

Usage

-0 to -255Expect that the command exits with the given exit status.
!Expect that the command exits with a non-zero exit status.
--keep-empty-linesKeep empty lines in ${lines[0]}.
--separate-stderrStore STDOUT in $output and STDERR in $stderr. Lines are stored in $lines and $stderr_lines.

Examples

Executing a command with run
1
2
3
@test "executing a command with run" {
    run -0 command -v bash
}
BashSupport Pro is a shell script IDE with support for bats-core’s runtry it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal