Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Issue with string slices



Zsh is not printing the character "-"

Example 1:
arg="--help"
echo ${arg[1]}
echo ${arg[2]}
echo ${arg[3]}

Expected:
-
-
h

Got:
(new line empty)
(new line empty)
h


Example 2:
arg="--help"
echo ${arg:0:1}
echo ${arg:0:2}
echo ${arg:1:1}
echo ${arg:1:2}

Expected:
-
-
-
h

Got:
(new line empty)
--
(new line empty)
-h




Messages sorted by: Reverse Date, Date, Thread, Author