- Decida se é
dstepoudlstep. -
for i in {1..$n}The BashParser performs BraceExpansion before any other expansions or substitutions. So the brace expansion code sees the literal
$n, which is not numeric, and therefore it doesn't expand the curly braces into a list of numbers. This makes it nearly impossible to use brace expansion to create lists whose size is only known at run-time.Do this instead:
for ((i=1; i<=n; i++)); do ... doneOu use
seq. -
Seu script lê
$cindex_como uma variável com o nomecindex_. Você quer${cindex}_. -
Cite as variáveis corretamente. Pode não ser crucial aqui, mas em geral. Por exemplo:
mkdir "${cindex}_$dindex" -
Não há shebang. Não importa se você comprou o roteiro; mas se você executá-lo, deve haver um shebang como
#!/bin/bashou#!/usr/bin/env bash. Por causa de$1,$2etc. Acho que o script foi criado para ser executado.