NAME

BATsh::SH - Pure Perl bash/sh interpreter for BATsh

SYNOPSIS

# Used internally by BATsh; not normally called directly.
BATsh::SH::exec_block('BATsh::SH', \@lines, _batsh => $batsh);

DESCRIPTION

BATsh::SH implements the POSIX sh / bash command set entirely in Perl. No external sh or bash is required.

Supported Features

VAR=value, export VAR=value, unset VAR
echo, printf
if/then/elif/else/fi
for VAR in list; do ... done
while condition; do ... done
until condition; do ... done
case $var in pattern) ... ;; esac
test / [ ... ]  (file tests, string, integer comparisons)
cd, pwd, exit, true, false, :, read, shift, local, set
$(( arithmetic ))
$( command substitution )
${VAR}, ${VAR:-default}, ${VAR:=default}
source / . file

Variable Expansion

$VAR and ${VAR} references are expanded before each line executes. Arithmetic expressions $(( expr )) support +, -, *, /, % and parentheses.

AUTHOR

INABA Hitoshi <ina@cpan.org>

LICENSE

Same as Perl itself.