mkdir $(seq --format 's%.0f' 1 50)
or if you want zero-padded numbers (which would be better for sorting):
mkdir $(seq --format 's%02.0f' 1 50)
or:
mkdir s$(seq -s ' s' -w 1 50)
-- note the string 's' just before the $()
, without it the first directory created will be just '01' rather than 's01'
and, finally: mkdir $(printf "s%02i " $(seq 1 50))
seq
is from GNU Coreutils
oddly, seq's --format
or -f
option only allows printf's floating point double types (like f and g. also a strange floating point hex format that i've never found any use for). I have no idea why. It would be nice if it also supported other printf(3)
numeric types like integer (d,i), octal (o,U) or hex (x,X).
Anyway, a double format with 0 decimal precision like %.0f
or %02.0f
is close enough to an integer for this purpose.
$ seq --help
Usage: seq [OPTION]... LAST
or: seq [OPTION]... FIRST LAST
or: seq [OPTION]... FIRST INCREMENT LAST
Print numbers from FIRST to LAST, in steps of INCREMENT.
-f, --format=FORMAT use printf style floating-point FORMAT
-s, --separator=STRING use STRING to separate numbers (default: \n)
-w, --equal-width equalize width by padding with leading zeroes
--help display this help and exit
--version output version information and exit
If FIRST or INCREMENT is omitted, it defaults to 1. That is, an
omitted INCREMENT defaults to 1 even when LAST is smaller than FIRST.
FIRST, INCREMENT, and LAST are interpreted as floating point values.
INCREMENT is usually positive if FIRST is smaller than LAST, and
INCREMENT is usually negative if FIRST is greater than LAST.
FORMAT must be suitable for printing one argument of type `double';
it defaults to %.PRECf if FIRST, INCREMENT, and LAST are all fixed point
decimal numbers with maximum precision PREC, and to %g otherwise.
See also: http://www.gnu.org/software/coreutils/manual/html_node/seq-invocation.html
bash
. Thank you for your time!s01
,s02
, ... ,s49
,s50
. If I used fixed-width indices,/bin/ls
almost always produces the order I want.