In Terminal, I prefer to use bash as my default shell. Issuing the command touch File_{01..10}.txt
produces these results:
File_1.txt, File_10.txt, File_2.txt, File_3.txt, File_4.txt, File_5.txt, File_6.txt, File_7.txt, File_8.txt, File_9.txt
As you can see, there are no leading zeros in the file names.
However, using zsh
, the same command touch File_{01..10}.txt
produces these results:
File_01.txt, File_02.txt, File_03.txt, File_04.txt, File_05.txt, File_06.txt, File_07.txt, File_08.txt, File_09.txt, File_10.txt
As you can see, zsh
produces the desired results with the leading zeros.
Is there anyway I can configure bash
to produce the same results as zsh
for use with the touch
command?
bash
.echo {01..10}
. This may depend on the shell version: Mybash
(4.4) also produces the expansion with leading zeroes, like zsh.