@@ -580,6 +580,7 @@ echo $((1?2?3:4:5))
580
580
581
581
# ### Empty expression: $(())
582
582
case $SH in (dash) exit 1;; esac
583
+ shopt -s parse_empty_arith 2> /dev/null
583
584
echo 1:$( ())
584
585
echo 2:$(( ))
585
586
# # STDOUT:
@@ -593,6 +594,7 @@ echo 2:$(( ))
593
594
# dash/mksh doesn't support $[]
594
595
# oil has different meaning for $[]
595
596
case ${SH##*/ } in (dash|mksh|osh) exit 1;; esac
597
+ shopt -s parse_empty_arith 2> /dev/null
596
598
echo 3:$[]
597
599
echo 4:$[ ]
598
600
# # STDOUT:
@@ -604,6 +606,7 @@ echo 4:$[ ]
604
606
605
607
# ### Empty expression: (())
606
608
case $SH in (dash) exit 1;; esac
609
+ shopt -s parse_empty_arith 2> /dev/null
607
610
(( )) && echo unexpected || echo OK
608
611
(( )) && echo unexpected || echo OK
609
612
! (( )) && echo OK || echo unexpected
@@ -623,6 +626,7 @@ case $SH in
623
626
(mksh|zsh) exit 1;; # mksh/zsh does not support.
624
627
(bash) exit 1;; # bash supports this from bash-5.0.
625
628
esac
629
+ shopt -s parse_empty_arith 2> /dev/null
626
630
627
631
arr=(foo bar)
628
632
echo " ${arr[ ]} "
635
639
# ### Empty expression: ${var::}
636
640
case $SH in
637
641
(dash) exit 1;; # dash does not support arrays.
638
- (dash) exit 1;; # zsh does not support empty offset/length.
642
+ (zsh) exit 1;; # zsh does not support empty offset/length.
639
643
esac
644
+ shopt -s parse_empty_arith 2> /dev/null
645
+
640
646
var=abcd
641
647
echo " 1:[${var:: 1} ]"
642
648
echo " 2:[${var: : 1} ]"
@@ -661,6 +667,7 @@ case $SH in
661
667
(mksh) exit 1;; # mksh does not support ${array[@]:offset:length}
662
668
(zsh) exit 1;; # zsh does not support empty offset/length
663
669
esac
670
+ shopt -s parse_empty_arith 2> /dev/null
664
671
array=(1 2 3)
665
672
argv.py " ${array[@]:: 1} "
666
673
argv.py " ${array[@]: : 1} "
0 commit comments