Branch Coverage

lib/BATsh/SH.pm
Criterion Covered Total %
branch 771 1314 58.6


line true false branch
57 0 15 if ($] < "5.006" and not defined &warnings::import)
59 0 15 if $INC[-1] eq "."
150 2 148 defined $_EXIT_CODE ? :
164 2 478 if defined $_EXIT_CODE
165 0 478 if $_BREAK or $_RETURN
172 18 460 if $line =~ /\A\s*\z/
173 0 460 if $line =~ /\A\s*#/
180 460 0 defined $first ? :
182 7 453 if ($first eq "if")
186 14 439 if ($first eq "for")
190 6 433 if ($first eq "while" or $first eq "until")
194 18 415 if ($first eq "case")
200 6 409 if ($stripped =~ /\A(?:function\s+[A-Za-z_]|[A-Za-z_][A-Za-z0-9_]*\s*\(\s*\))/)
209 13 396 if (@hd)
218 2 27 if $dash
219 12 17 if ($probe eq $delim)
220 1 16 if $dash
223 1 12 unless ($terminated)
234 0 396 if $_CONTINUE
247 0 470 if $line =~ /\A\s*\z/
248 0 470 if $line =~ /\A\s*#/
251 0 470 if $line =~ /\A#!/
263 3 467 if ($_is_bg)
269 0 3 unless defined $w0
270 2 1 if (_sh_word_is_foreground($w0))
283 13 454 if (@compound > 1)
291 17 437 if (@pipe_segs > 1)
300 38 399 if @h
309 17 382 if ($probe =~ /\Atrap(\s.*|)\z/is and not $probe =~ /\Atrap\s*=/)
320 0 114 if ($pairs_ref and defined $remainder and $remainder ne "")
341 0 382 if (@{$sh_redirs_ref;})
347 0 382 unless defined $cmd and $cmd ne ""
355 114 268 if ($line =~ /\A([A-Za-z_][A-Za-z0-9_]*)=(.*)\z/s)
365 35 233 if ($lc_cmd eq "export")
366 4 229 if ($lc_cmd eq "unset")
367 150 79 if ($lc_cmd eq "echo")
369 7 143 if ($rest =~ /[*?\[]/)
375 0 79 if ($lc_cmd eq "printf")
376 0 79 if ($lc_cmd eq "cd")
377 0 79 if ($lc_cmd eq "pwd")
378 2 77 if ($lc_cmd eq "exit")
379 2 75 if ($lc_cmd eq "true")
380 4 71 if ($lc_cmd eq "false")
381 0 71 if ($lc_cmd eq ":")
382 12 59 if ($lc_cmd eq "read")
383 26 33 if ($lc_cmd eq "test" or $cmd eq "[")
384 0 33 if ($lc_cmd eq "source" or $cmd eq ".")
385 0 0 $rest =~ /\A\s*(\d+)/ ? :
0 33 if ($lc_cmd eq "return")
386 0 33 if ($lc_cmd eq "break")
387 0 33 if ($lc_cmd eq "continue")
388 2 31 if ($lc_cmd eq "shift")
389 2 29 if ($lc_cmd eq "local")
390 0 29 if ($lc_cmd eq "set")
393 6 23 if (exists $BATsh::SH::_SH_FUNCTIONS{$cmd})
406 0 537 unless defined $str
445 2 0 defined $v ? :
463 15 0 defined $v ? :
470 1 0 defined $v ? :
475 1 0 defined $v ? :
480 1 0 defined $v ? :
485 1 0 defined $v ? :
490 1 0 defined $v ? :
495 1 0 defined $v ? :
500 1 0 defined $v ? :
505 1 0 defined $v ? :
510 0 0 defined $v ? :
515 1 0 defined $v ? :
520 0 0 defined $v ? :
526 1 0 defined $v ? :
528 0 1 if $off < 0
529 0 1 if $off < 0
535 0 0 defined $v ? :
537 0 0 if $off < 0
538 0 0 if $off < 0
545 0 2 if (defined $v and $v ne '') { }
550 0 0 if (not defined $v or $v eq "")
555 0 0 defined $v && $v ne '' ? :
562 0 47 if (_arr_exists($n)) { }
563 0 0 defined $v ? :
566 47 0 defined $v ? :
582 0 0 defined $v ? :
589 0 7 unless defined $v and $v ne ""
590 7 0 defined $v ? :
595 0 0 defined $v ? :
603 0 0 unless defined $vv and $vv ne ""
604 0 0 unless defined $vv and $vv ne ""
615 1 104 if (_arr_exists($n)) { }
616 1 0 defined $v ? :
619 104 0 defined $v ? :
645 46 0 if ($expr =~ m[\A[\d\s\+\-\*/\%\(\)]+\z])
647 46 0 defined $result ? :
655 0 5 unless defined $v and $v ne ""
656 5 0 defined $v && $v =~ /\A-?\d+\z/ ? :
662 42 0 defined $v && $v =~ /\A-?\d+\z/ ? :
674 0 537 unless defined $str
685 14 215 if ($ch eq "\$" and $i + 1 < $n and $chars[$i + 1] eq "(")
695 0 386 if ($in_sq)
696 0 0 if ($c eq "'")
699 0 386 if ($c eq "'" and not $in_dq)
702 22 364 if ($c eq "\"" and not $in_sq)
705 88 276 if ($in_dq)
706 0 88 if ($c eq "\\")
708 0 0 if $i < $n
712 0 276 if ($c eq "\\")
714 0 0 if $i < $n
716 6 270 if ($c eq "(")
717 20 250 if ($c eq ")")
719 14 6 if ($depth == 0)
749 0 15 unless open _SUBST_SAVOUT, ">&STDOUT"
752 0 15 unless (open _SUBST_CAPFH, "> $tmpfile")
754 0 15 unless (open STDOUT, ">&_SUBST_CAPFH")
766 15 0 if (open _SUBST_READFH, "< $tmpfile")
772 0 15 unless defined $output
784 0 35 if ($rest =~ /\A-p\s*\z/)
794 34 1 if ($item =~ /\A([A-Za-z_][A-Za-z0-9_]*)=(.*)\z/s) { }
1 0 elsif ($item =~ /\A([A-Za-z_][A-Za-z0-9_]*)\z/) { }
812 0 4 if $var eq ""
814 2 2 if ($var =~ /\A([A-Za-z_][A-Za-z0-9_]*)\[([^\]]*)\]\z/)
817 2 0 if (exists $BATsh::SH::_SH_ARRAY{$k})
818 0 2 if (defined $BATsh::SH::_SH_ARRAY_TYPE{$k} and $BATsh::SH::_SH_ARRAY_TYPE{$k} eq 'assoc') { }
829 1 1 if (exists $BATsh::SH::_SH_ARRAY{$k})
846 0 150 if ($rest =~ s/\A-n\s*//)
849 0 150 if ($rest =~ s/\A-e\s*//)
850 0 150 if ($escape)
860 0 150 if ($no_newline) { }
874 0 0 if ($rest =~ s/\A"((?:[^"\\]|\\.)*)"\s*//) { }
0 0 elsif ($rest =~ s/\A'([^']*)'\s*//) { }
882 0 0 unless defined $rest
899 0 0 if ($rest eq "" or $rest eq "~")
902 0 0 unless (chdir $rest)
918 2 0 $rest =~ /\A(\d+)/ ? :
921 2 0 if (exists $BATsh::SH::_SH_TRAP{'EXIT'})
923 2 0 if (defined $cmd and $cmd ne "")
950 1 16 if ($mode eq "list")
951 0 1 @{$sigs;} ? :
954 0 1 unless exists $BATsh::SH::_SH_TRAP{$sig}
963 0 17 if $sig eq ""
964 2 15 if ($mode eq 'reset') { }
1 14 elsif ($mode eq 'ignore') { }
986 0 17 unless defined $s
988 1 16 if $s eq ""
990 0 16 if ($s =~ /\A-p\b\s*(.*)\z/s)
996 14 2 if ($s =~ /\A'([^']*)'\s*(.*)\z/s) { }
0 2 elsif ($s =~ /\A"((?:[^"\\]|\\.)*)"\s*(.*)\z/s) { }
1005 0 2 unless defined $rest
1009 2 14 if not $quoted and $action eq "-"
1010 1 13 if $quoted and $action eq ""
1018 0 18 unless defined $s
1020 0 18 if $s eq ""
1023 1 17 if ($s =~ /\A\d+\z/)
1027 1 0 exists $num{$s + 0} ? :
1037 0 10 if $sig eq "EXIT" or $sig eq "ERR" or $sig eq "DEBUG" or $sig eq "RETURN"
1045 0 0 defined $_[0] ? :
1046 0 0 unless $w =~ /No such signal/
1049 1 9 if ($what eq 'DEFAULT') { }
1 8 elsif ($what eq 'IGNORE') { }
1060 0 2 unless defined $cmd and $cmd ne ""
1068 163 3 unless exists $BATsh::SH::_SH_TRAP{'EXIT'}
1070 0 3 if not defined $cmd or $cmd eq ""
1081 0 12 unless defined $rest
1087 12 0 if length $_
1090 2 10 unless (defined $line)
1100 10 0 if (@vars == 1) { }
0 0 elsif (@vars > 1) { }
1106 0 0 defined $words[$i] ? :
1118 2 0 unless defined $rest
1123 0 0 if $n_shift < 1
0 2 if ($rest =~ /\A(\d+)\s*\z/)
1129 0 16 defined $next ? :
1136 16 0 defined $next ? :
1144 2 4 unless defined $v and $v ne ""
1161 1 1 if ($rest =~ /\A([A-Za-z_][A-Za-z0-9_]*)=(.*)\z/s) { }
1 0 elsif ($rest =~ /\A([A-Za-z_][A-Za-z0-9_]*)\s*\z/) { }
1170 0 1 unless defined $val
1178 2 0 if (@FUNCTION_STACK)
1181 2 0 unless (exists $frame->{$var})
1183 2 0 defined $old ? :
1209 0 0 if (defined $opts_ref->{'_batsh'})
1211 0 0 if ($@)
1224 17 9 $result ? :
1234 0 26 if ($expr =~ /^(.*)\s+-a\s+(.*)$/)
1237 0 26 if ($expr =~ /^(.*)\s+-o\s+(.*)$/)
1241 0 26 if ($expr =~ /^!\s+(.*)$/)
1246 2 24 if ($expr =~ /\A(-[a-z])\s+(.+)\z/)
1249 0 0 -e $path ? :
0 2 if ($op eq "-e")
1250 0 0 -f $path ? :
0 2 if ($op eq "-f")
1251 0 0 -d $path ? :
0 2 if ($op eq "-d")
1252 0 0 -r $path ? :
0 2 if ($op eq "-r")
1253 0 0 -w $path ? :
0 2 if ($op eq "-w")
1254 0 0 -x $path ? :
0 2 if ($op eq "-x")
1255 0 0 -s $path ? :
0 2 if ($op eq "-s")
1256 1 0 !defined($s) || $s == 0 ? :
1 1 if ($op eq "-z")
1257 1 0 length $path > 0 ? :
1 0 if ($op eq "-n")
1258 0 0 -l $path ? :
0 0 if ($op eq "-L")
1262 0 24 if ($expr =~ /\A(.+?)\s+(=|==|!=|<|>)\s+(.+)\z/)
1266 0 0 $a eq $b ? :
0 0 if ($op eq "=" or $op eq "==")
1267 0 0 $a ne $b ? :
0 0 if ($op eq "!=")
1268 0 0 $a lt $b ? :
0 0 if ($op eq "<")
1269 0 0 $a gt $b ? :
0 0 if ($op eq ">")
1273 24 0 if ($expr =~ /\A(.+?)\s+(-eq|-ne|-lt|-le|-gt|-ge)\s+(.+)\z/)
1277 24 0 if $a =~ /\A-?\d+\z/
1278 24 0 if $b =~ /\A-?\d+\z/
1279 1 1 $a == $b ? :
2 22 if ($op eq "-eq")
1280 0 0 $a != $b ? :
0 22 if ($op eq "-ne")
1281 10 3 $a < $b ? :
13 9 if ($op eq "-lt")
1282 0 0 $a <= $b ? :
0 9 if ($op eq "-le")
1283 2 0 $a > $b ? :
2 7 if ($op eq "-gt")
1284 2 5 $a >= $b ? :
7 0 if ($op eq "-ge")
1288 0 0 if ($expr =~ /\A-n\s+(.+)\z/)
1290 0 0 length $s > 0 ? :
1293 0 0 if ($expr =~ /\A-z\s+(.+)\z/)
1295 0 0 length $s == 0 ? :
1300 0 0 length $expr > 0 && $expr ne '0' ? :
1326 0 7 if ($cond_str =~ /\A(.+?)\s*;\s*then\s+(.+?)\s*;\s*fi\s*\z/i)
1329 0 0 if ($cond_status == 0)
1346 16 0 $ls =~ /\A(\S+)/ ? :
1348 4 12 if ($lc_first eq 'fi') { }
1 11 elsif ($lc_first eq 'elif') { }
3 8 elsif ($lc_first eq 'else') { }
0 8 elsif ($lc_first eq 'then') { }
1369 6 0 $els =~ /\A(\S+)/ ? :
3 3 if (lc($els =~ /\A(\S+)/ ? $1 : "") eq "fi")
1390 6 2 if ($cond_status == 0)
1396 1 6 if (not $executed and defined $else_body)
1423 14 0 if ($for_line =~ /\Afor\s+([A-Za-z_][A-Za-z0-9_]*)\s+in\s+(.*?)\s*;\s*do\b\s*(.*)\z/is) { }
0 0 elsif ($for_line =~ /\Afor\s+([A-Za-z_][A-Za-z0-9_]*)\s+in\s+(.*?)\s*\z/i) { }
1427 3 11 if ($tail eq '') { }
11 0 elsif ($tail =~ /\A(.*);\s*done\b\s*\z/s) { }
0 0 elsif ($tail eq 'done') { }
1446 11 3 if (defined $inline_body)
1447 11 0 unless $inline_body eq ""
1449 3 11 unless ($inline_closed)
1455 6 0 $ls =~ /\A(\S+)/ ? :
1456 0 6 if ($lc_f eq "for" or $lc_f eq "while" or $lc_f eq "until")
1457 3 0 if $depth == 0
3 3 if ($lc_f eq "done")
1458 3 0 unless $lc_f eq "do" and $depth == 1
1472 0 74 if $_BREAK or defined $_EXIT_CODE
1490 2 4 $while_line =~ /\Auntil\s/i ? :
1504 6 0 if ($rest =~ /\A(.*?)\s*;\s*do\b\s*(.*)\z/s) { }
1508 2 4 if ($tail eq '') { }
4 0 elsif ($tail =~ /\A(.*);\s*done\b\s*(.*)\z/s) { }
0 0 elsif ($tail =~ /\Adone\b\s*(.*)\z/s) { }
1515 1 3 $dr ne '' ? :
1521 0 0 $dr ne '' ? :
1534 4 2 if (defined $inline_body)
1535 4 0 unless $inline_body eq ""
1537 2 4 unless ($inline_closed)
1543 4 0 $ls =~ /\A(\S+)/ ? :
1544 0 4 if ($lc_f eq "for" or $lc_f eq "while" or $lc_f eq "until")
1545 2 0 if ($depth == 0)
2 2 if ($lc_f eq "done")
1546 2 0 unless $lc_f eq "do" and $depth == 1
1556 6 0 if ($done_line ne "")
1559 1 5 if ($done_rest ne "")
1564 1 0 if $fd == 0
1566 1 0 if (defined $in_file and $in_file ne "")
1567 1 0 if (open _WH_REDIR_SRC, "< $in_file") { }
1568 1 0 if (open _WH_REDIR_SAVIN, "<&STDIN")
1569 1 0 if (open STDIN, "<&_WH_REDIR_SRC")
1583 0 24 if defined $_EXIT_CODE
1586 2 22 if $is_until and $cond_true
1587 4 13 unless $is_until or $cond_true
1590 0 18 if $_BREAK
1594 1 5 if ($saved_in)
1619 18 0 if ($case_line =~ /\Acase\s+(.*?)\s+in\b\s*(.*)\z/is) { }
1636 1 17 if ($pos >= 0) { }
1643 17 44 if ($pos >= 0)
1661 16 24 if $stop
1663 0 24 unless $ctext =~ /\S/
1666 0 24 unless defined $pattern_str
1669 2 22 if ($fall) { }
1676 0 24 if $pat eq ""
1677 19 5 if (_match_pattern($word, $pat))
1681 21 3 if ($run)
1684 0 21 if $_BREAK or $_CONTINUE or $_RETURN or defined $_EXIT_CODE
1685 18 3 if ($term eq ';;') { }
2 1 elsif ($term eq ';&') { }
1700 17 62 unless defined $s and $s ne ""
1706 0 0 if $ch eq "'"
0 791 if ($sq)
1707 0 791 if ($ch eq "'" and not $dq)
1708 8 783 if ($ch eq "\"")
1709 18 765 if (not $dq and lc substr($s, $i, 4) eq "esac")
1710 0 18 $i + 4 < $n ? :
1711 18 0 $i + 4 >= $n || $after =~ /\s/ ? :
1714 18 0 $j < 0 || $c[$j] eq ';' || $c[$j] eq '&' || $c[$j] eq "\n" ? :
1716 18 0 if $aok and $bok
1734 0 0 if $ch eq "'"
0 791 if ($sq)
1735 0 791 if ($ch eq "'" and not $dq)
1736 8 783 if ($ch eq "\"")
1737 746 37 unless ($sq or $dq)
1738 1 745 if (substr($s, $i, 3) eq ";;&")
1741 39 706 if (substr($s, $i, 2) eq ";;")
1744 2 704 if (substr($s, $i, 2) eq ";&")
1750 0 18 if $cur =~ /\S/
1768 0 0 if $ch eq "'"
0 88 if ($sq)
1769 0 88 if ($ch eq "'" and not $dq)
1770 2 86 if ($ch eq "\"")
1771 85 1 unless ($sq or $dq)
1772 3 82 if ($ch eq '[') { }
3 79 elsif ($ch eq ']') { }
24 110 elsif ($ch eq ')' and not $cls) { }
1778 0 24 if $found < 0
1780 24 0 $found + 1 <= length $s ? :
1794 0 0 if $ch eq "'"
0 62 if ($sq)
1795 0 62 if ($ch eq "'" and not $dq)
1796 2 60 if ($ch eq "\"")
1797 59 1 unless ($sq or $dq)
1798 3 56 if ($ch eq '[') { }
3 53 elsif ($ch eq ']') { }
4 98 elsif ($ch eq '|' and not $cls) { }
1813 0 24 unless defined $word
1815 19 5 $word =~ /\A$re\z/ ? :
1820 0 24 unless defined $pat
1827 0 41 if ($ch eq "'")
1832 1 40 if ($ch eq "\"")
1835 0 1 if ($c[$i] eq "\\" and $i + 1 < $n)
1842 0 40 if ($ch eq "\\")
1843 0 0 if $i < $n
1845 4 36 if ($ch eq "*")
1846 0 36 if ($ch eq "?")
1847 3 33 if ($ch eq "[")
1850 1 2 if ($j < $n and $c[$j] eq '!' || $c[$j] eq '^')
1852 0 3 if ($j < $n and $c[$j] eq "]")
1855 0 9 if ($cc eq "\\" and $j + 1 < $n)
1858 0 9 if ($cc eq '\\' or $cc eq '^' or $cc eq ']') { }
1862 3 0 if ($j < $n and $c[$j] eq "]")
1863 1 2 $neg ? :
1915 4 4209 if ($in_sq)
1916 1 3 if ($ch eq "'")
1919 1 4208 if ($ch eq "'" and not $in_dq)
1922 158 4050 if ($ch eq "\"" and not $in_sq)
1925 407 3643 if ($in_dq)
1926 0 407 if ($ch eq "\\")
1928 0 0 if $i < $n
1934 0 3643 if ($ch eq "\\")
1936 0 0 if $i < $n
1940 0 0 $i + 3 < $n ? :
0 0 if ($ch =~ /[012]/ and $i + 2 < $n and $chars[$i + 1] eq ">" and $i + 3 < $n ? $chars[$i + 2] eq ">" : 0 and $chars[$i + 3] eq "&")
1952 0 153 if ($ch =~ /[012]/ and $i + 2 < $n and $chars[$i + 1] eq ">" and $chars[$i + 2] eq "&")
1964 0 3643 if ($ch =~ /[012]/ and $i + 1 < $n and $chars[$i + 1] eq '>') { }
1 3642 elsif ($ch eq '<') { }
0 3642 elsif ($ch eq '>') { }
1973 1 0 if $file ne ""
1980 0 3642 if (defined $redir_fd)
1983 0 0 if ($i + 1 < $n and $chars[$i + 1] eq ">")
1992 0 0 if $file ne ""
2018 12 0 if ($fd == 0) { }
0 0 elsif ($fd == 1) { }
2020 0 0 if ($file eq '&2') { }
2024 0 0 if ($file eq '&1') { }
2033 12 0 if (defined $in_file and $ok)
2035 0 12 unless (open _SH_REDIR_SRC, $in_file)
2036 12 0 if ($ok)
2037 0 12 unless (open _SH_REDIR_SAVIN, "<&STDIN")
2039 12 0 if ($ok)
2040 0 12 unless (open STDIN, "<&_SH_REDIR_SRC")
2047 0 12 if (defined $out_file and $ok) { }
0 24 elsif ($out_to_stderr and $ok) { }
2048 0 0 $out_app ? :
2050 0 0 unless (open _SH_REDIR_DST, "$mode$out_file")
2051 0 0 if ($ok)
2052 0 0 unless (open _SH_REDIR_SAVOUT, ">&STDOUT")
2054 0 0 if ($ok)
2055 0 0 unless (open STDOUT, ">&_SH_REDIR_DST")
2061 0 0 unless (open _SH_REDIR_SAVOUT, ">&STDOUT")
2062 0 0 if ($ok)
2063 0 0 unless (open STDOUT, ">&STDERR")
2069 0 12 if (defined $err_file and $ok) { }
0 24 elsif ($err_to_stdout and $ok) { }
2070 0 0 $err_app ? :
2072 0 0 unless (open _SH_REDIR_DST, "$mode$err_file")
2073 0 0 if ($ok)
2074 0 0 unless (open _SH_REDIR_SAVERR, ">&STDERR")
2076 0 0 if ($ok)
2077 0 0 unless (open STDERR, ">&_SH_REDIR_DST")
2084 0 0 unless (open _SH_REDIR_SAVERR, ">&STDERR")
2085 0 0 if ($ok)
2086 0 0 unless (open STDERR, ">&STDOUT")
2092 12 0 if ($ok)
2097 0 12 if ($saved_err)
2098 0 12 if ($saved_out)
2099 12 0 if ($saved_in)
2120 150 6761 if ($in_sq)
2121 15 135 if ($ch eq "'")
2124 15 6746 if ($ch eq "'" and not $in_dq)
2127 242 6504 if ($ch eq "\"" and not $in_sq)
2130 918 5586 if ($in_dq)
2131 0 918 if ($ch eq '$' and $i + 1 < $n and $chars[$i + 1] eq '(') { }
0 1836 elsif ($ch eq ')' and $depth > 0) { }
2137 73 115 if ($ch eq "\$" and $i + 1 < $n and $chars[$i + 1] eq "(")
2140 73 5440 if ($ch eq ")" and $depth > 0)
2145 786 4654 if ($depth > 0)
2148 0 4654 if ($ch eq "\\")
2150 0 0 if $i < $n
2154 3 0 if ($ch eq "&" and $i + 1 < $n and $chars[$i + 1] eq "&")
2161 2 18 if ($ch eq "|" and $i + 1 < $n and $chars[$i + 1] eq "|")
2168 9 4640 if ($ch eq ";")
2180 14 481 if $p->{'op'} ne ""
2181 13 454 if $has_op
2198 27 14 if ($op eq '') { }
2200 13 14 if ($pending_op eq '') { }
3 11 elsif ($pending_op eq '&&') { }
2 9 elsif ($pending_op eq '||') { }
9 0 elsif ($pending_op eq ';') { }
2201 13 0 if $cmd =~ /\S/
2204 1 2 if ($LAST_STATUS == 0 and $cmd =~ /\S/)
2209 2 0 if ($LAST_STATUS != 0 and $cmd =~ /\S/)
2214 9 0 if $cmd =~ /\S/
2241 150 6346 if ($in_sq)
2242 15 135 if ($ch eq "'")
2247 220 6126 if ($ch eq "\"" and not $in_sq)
2253 836 5290 if ($in_dq)
2254 0 76 if ($ch eq "\$" and $i + 1 < $n and $chars[$i + 1] eq "(")
2257 0 836 if ($ch eq ")" and $depth > 0)
2261 0 836 if ($ch eq "\\")
2263 0 0 if $i < $n
2269 15 5275 if ($ch eq "'")
2276 66 113 if ($ch eq "\$" and $i + 1 < $n and $chars[$i + 1] eq "(")
2279 44 25 if $depth > 0
69 5140 if ($ch eq "(")
2280 135 5005 if ($ch eq ")")
2281 110 25 if ($depth > 0)
2286 18 4987 if ($ch eq "|" and $depth == 0)
2288 0 18 if ($i + 1 < $n and $chars[$i + 1] eq "|")
2297 0 4987 if ($ch eq "\\")
2299 0 0 if $i < $n
2333 0 35 unless $seg =~ /\S/
2335 17 18 $idx == $n_segs - 1 ? :
2336 17 18 $is_last ? :
2340 18 17 if (defined $input_f and -f $input_f)
2342 0 18 unless (open _SH_PIPE_RFH, $input_f)
2344 0 18 unless (open _SH_PIPE_SAVIN, "<&STDIN")
2346 0 18 unless (open STDIN, "<&_SH_PIPE_RFH")
2357 18 17 if (defined $output_f)
2359 0 18 unless (open _SH_PIPE_WFH, ">$output_f")
2360 0 0 if ($saved_in)
2367 0 18 unless (open _SH_PIPE_SAVOUT, ">&STDOUT")
2369 0 0 if ($saved_in)
2375 0 18 unless (open STDOUT, ">&_SH_PIPE_WFH")
2378 0 0 if ($saved_in)
2391 18 17 if ($saved_out)
2397 18 17 if ($saved_in)
2406 0 17 if defined $input_f and -f $input_f
2425 0 5 unless $word =~ /[*?\[]/
2427 4 1 @matches ? :
2454 4 8 if ($c eq '*') { }
0 8 elsif ($c eq '?') { }
0 8 elsif ($c eq '[') { }
2455 3 1 $greedy ? :
2480 1 1 if ($greedy) { }
2482 1 0 $val =~ /\A(.*?)$re\z/s ? :
2486 1 0 $val =~ /\A(.*)$re\z/s ? :
2497 2 0 $val =~ /\A$re(.*)\z/s ? :
2503 1 1 if ($global) { }
2524 6 0 if ($line =~ /\A([A-Za-z_][A-Za-z0-9_]*)\s*\(\s*\)\s*(?:\{.*)?\z/) { }
0 0 elsif ($line =~ /\Afunction\s+([A-Za-z_][A-Za-z0-9_]*)\s*(?:\(\s*\))?\s*(?:\{.*)?\z/i) { }
2535 6 0 $line =~ /\{/ ? :
2540 1 5 if ($depth >= 1 and $line =~ /\{(.*)\}\s*\z/s)
2546 1 0 if $part =~ /\S/
2552 0 5 if ($depth == 0)
2556 0 0 if ($l =~ /\{/)
2566 5 8 if ($depth <= 0)
2569 0 5 if $before =~ /\S/
2584 0 6 unless exists $BATsh::SH::_SH_FUNCTIONS{$name}
2591 5 49 defined $args[$n - 1] ? :
2597 5 49 defined $args[$n - 1] ? :
2611 6 0 if (@FUNCTION_STACK)
2615 2 0 if (defined $old) { }
2623 0 54 defined $v ? :
2627 1 53 defined $v ? :
2629 0 6 defined $saved_star ? :
2640 0 13 unless defined $str
2642 2 11 unless $str =~ /\S/
2650 4 85 if ($in_sq)
2651 1 3 if ($ch eq q[']) { }
2654 1 84 if ($ch eq "'" and not $in_dq)
2655 6 78 if ($ch eq "\"" and not $in_sq)
2656 1 2 if ($ch =~ /\s/ and not $in_sq and not $in_dq)
2664 11 0 if $cur ne "" or @args
2665 11 0 if $cur ne "" or @quoted
2669 3 9 if (not $quoted[$i] and $args[$i] =~ /[*?\[]/) { }
2683 0 23 unless defined $rest
2685 23 0 $rest ne '' ? :
2688 23 0 $rc == 0 ? :
2705 0 477 unless defined $line
2710 0 477 if $rtrim eq ""
2714 469 8 unless $chars[$last] eq "&"
2717 0 8 if $last >= 1 and $chars[$last - 1] eq "&"
2719 0 8 if $last >= 1 and $chars[$last - 1] eq ">"
2730 0 87 if ($in_sq)
2731 0 0 if $ch eq "'"
2734 1 86 if ($ch eq "\\" and not $in_sq)
2735 1 0 if $i + 1 == $last
2738 0 86 if ($ch eq "'" and not $in_dq)
2739 2 84 if ($ch eq "\"" and not $in_sq)
2742 0 8 if $in_sq or $in_dq
2743 1 7 if $esc_last
2748 1 6 if $stripped eq ""
2759 0 6 unless defined $w and $w ne ""
2762 2 4 if $w =~ /\A[A-Za-z_][A-Za-z0-9_]*=/
2765 0 4 if $w eq "[" or $w eq ":" or $w eq "."
2775 2 2 if $builtin{$lc}
2783 0 2 if $kw{$lc}
2786 0 2 if exists $BATsh::SH::_SH_FUNCTIONS{$w}
2796 1 0 if $dir eq "" and -d "/tmp"
2797 0 1 if $dir eq ""
2799 0 1 unless -d $dir and -w $dir
2806 1 0 if (sysopen _BG_TMP, $path, 193, 384)
2827 0 1 unless defined $cmdline
2828 0 1 if $cmdline =~ /\A\s*\z/
2831 0 1 if ($^O =~ /MSWin32/i)
2833 0 0 if (defined $pid and $pid > 0) { }
2847 1 0 if (defined $pidfile) { }
2851 1 0 if (open _BG_PIDFH, "< $pidfile")
2855 0 1 unless defined $buf
2858 1 0 if defined $pid and $pid ne ""
2866 1 0 defined $rc && $rc != -1 ? :
2876 382 0 if ($line =~ /\A(\S+)\s*(.*)\z/s)
2906 0 382 if $i >= $n
2911 356 26 if ($chars[$j] =~ /[A-Za-z_]/)
2915 242 114 unless length $name and $j < $n and $chars[$j] eq "="
2926 0 0 if $c eq "'"
0 845 if ($in_sq)
2927 0 0 if ($c eq "'" and not $in_dq and not $in_bt)
2928 62 783 if ($c eq "\"" and not $in_bt)
2929 2 781 if (not $in_dq and $c eq "`")
2930 42 0 if (not $in_dq || $in_bt and $c eq "\$" and $j + 1 < $n and $chars[$j + 1] eq "(")
2933 42 493 if (not $in_dq || $in_bt and $depth > 0 and $c eq ")")
2936 0 147 if (not $in_sq || $in_dq || $in_bt and $depth == 0 and $c eq ' ' || $c eq "\t")
2949 114 0 if $k >= $n
2955 0 0 if ($chars[$m] =~ /[A-Za-z_]/)
2959 0 0 if (length $nm2 and $m < $n and $chars[$m] eq "=")
2971 268 114 unless @pairs
2996 300 9859 if ($in_sq)
2997 30 270 if $ch eq "'"
3000 30 9829 if ($ch eq "'" and not $in_dq)
3001 270 9559 if ($ch eq "\"" and not $in_sq)
3002 0 9559 if ($ch eq "\\")
3005 26 1 if (not $in_dq and $ch eq "<" and $i + 1 < $n and $chars[$i + 1] eq "<" and not $i + 2 < $n && $chars[$i + 2] eq '<')
3010 2 24 if ($j < $n and $chars[$j] eq "-")
3015 2 24 if ($j < $n and $chars[$j] eq q['] || $chars[$j] eq '"')
3019 2 24 if ($quoted) { }
3021 2 0 if $j < $n
3026 0 26 if $delim eq ""
3045 12 0 if $dir eq "" and -d "/tmp"
3046 0 12 if $dir eq ""
3048 0 12 unless -d $dir and -w $dir
3055 12 0 if (sysopen _HD_TMP, $path, 193, 384)
3074 11 1 unless ($quoted)
3081 0 12 unless (defined $tmp)
3092 0 0 if defined $f
3095 0 0 if defined $f
3107 4 151 exists $BATsh::SH::_SH_ARRAY{_arr_name($name)} ? :
3113 3 22 exists $BATsh::SH::_SH_ARRAY_TYPE{$k} && $BATsh::SH::_SH_ARRAY_TYPE{$k} eq 'assoc' ? :
3121 0 15 unless defined $s
3123 0 15 if $s eq ""
3124 14 1 if $s =~ /\A-?\d+\z/
3126 1 0 $v =~ /\A-?\d+\z/ ? :
3133 0 25 unless defined $s
3135 0 0 defined $v ? :
3138 3 0 defined $v ? :
3148 0 16 unless exists $BATsh::SH::_SH_ARRAY{$k}
3150 2 14 if (defined $BATsh::SH::_SH_ARRAY_TYPE{$k} and $BATsh::SH::_SH_ARRAY_TYPE{$k} eq "assoc")
3159 0 9 unless exists $BATsh::SH::_SH_ARRAY{$k}
3167 1 8 unless exists $BATsh::SH::_SH_ARRAY{$k}
3176 0 18 unless exists $BATsh::SH::_SH_ARRAY{$k}
3178 9 9 if (defined $BATsh::SH::_SH_ARRAY_TYPE{$k} and $BATsh::SH::_SH_ARRAY_TYPE{$k} eq "assoc")
3179 9 0 exists $h->{$sub} ? :
3182 1 8 if ($idx < 0)
3185 0 1 unless @keys
3187 1 0 defined $kk ? :
3189 8 0 exists $h->{$idx} ? :
3197 0 267 unless defined $v
3202 0 0 if ($c eq q[']) { }
0 1912 if ($in_sq)
3203 0 1912 if ($c eq "'" and not $in_dq)
3204 50 1862 if ($c eq "\"" and not $in_sq)
3214 0 39 unless defined $s
3225 0 0 if $c eq "'"
0 255 if ($in_sq)
3226 0 255 if ($c eq "'" and not $in_dq)
3227 10 245 if ($c eq "\"" and not $in_sq)
3228 54 191 if (not $in_sq || $in_dq and $c =~ /\s/)
3229 54 0 if ($have)
3234 39 0 if $have
3247 9 58 if ($tok =~ /\A\[(.*?)\]=(.*)\z/s) { }
3253 2 65 $vpart =~ /['"]/ ? :
3255 9 58 if (defined $sub) { }
0 58 elsif (not $raw_has_quote and $exp =~ /\s/) { }
3262 0 0 if $w eq ""
3279 23 2 if (not $append) { }
3281 3 20 $assoc ? :
3284 0 2 unless exists $BATsh::SH::_SH_ARRAY{$k}
3286 0 0 $assoc ? :
0 2 unless exists $BATsh::SH::_SH_ARRAY_TYPE{$k}
3293 3 22 if ($is_assoc) { }
3296 0 7 unless defined $sub
3303 3 1 if $ix =~ /\A-?\d+\z/ and $ix + 1 > $next
3307 2 58 if (defined $sub and $sub ne '') { }
3330 0 8 unless (exists $BATsh::SH::_SH_ARRAY{$k})
3335 6 2 defined $BATsh::SH::_SH_ARRAY_TYPE{$k} && $BATsh::SH::_SH_ARRAY_TYPE{$k} eq 'assoc' ? :
3337 1 7 if ($append) { }
3338 1 0 exists $BATsh::SH::_SH_ARRAY{$k}{$key} ? :
3351 0 7 unless defined $rest
3357 7 0 if ($flag =~ /A/) { }
0 0 elsif ($flag =~ /a/) { }
3358 0 0 unless defined $type
3363 0 7 if $rest eq ""
3364 2 5 if ($rest =~ /\A([A-Za-z_][A-Za-z0-9_]*)\+?=\((.*)\)\s*(.*)\z/s) { }
0 5 elsif ($rest =~ /\A([A-Za-z_][A-Za-z0-9_]*)=(\S*)\s*(.*)\z/s) { }
5 0 elsif ($rest =~ /\A([A-Za-z_][A-Za-z0-9_]*)\s*(.*)\z/s) { }
3367 2 0 if defined $type
3373 0 0 if (defined $type) { }
3390 5 0 unless exists $BATsh::SH::_SH_ARRAY{$k}
3391 5 0 defined $type ? :
3411 9 428 if ($s =~ /\A(declare|typeset|local)\b\s*(.*)\z/is)
3414 7 2 $args =~ /\A-[A-Za-z]*[aA]/ ? :
3415 2 7 $args =~ /=\(/ ? :
3416 0 2 if (not $is_local or $has_arr_flag or $has_arr_init)
3423 23 405 if ($s =~ /\A([A-Za-z_][A-Za-z0-9_]*)(\+?)=\((.*)\)\z/s)
3425 2 21 $plus eq '+' ? :
3430 8 397 if ($s =~ /\A([A-Za-z_][A-Za-z0-9_]*)\[([^\]]*)\](\+?)=(.*)\z/s)
3432 1 7 $plus eq '+' ? :
3449 2 24 if ($tok =~ /\A"?\$\{([A-Za-z_][A-Za-z0-9_]*)\[[\@*]\]\}"?\z/ and _arr_exists($1))
3455 1 23 if ($tok =~ /\A"?\$\{!([A-Za-z_][A-Za-z0-9_]*)\[[\@*]\]\}"?\z/ and _arr_exists($1))
3460 0 23 $tok =~ /['"]/ ? :
3462 23 0 if (not $raw_has_quote) { }
3463 2 21 if ($exp =~ /[*?\[]/) { }
0 21 elsif ($exp =~ /\s/) { }
21 0 elsif ($exp ne '') { }
3490 0 15 if ($@)