I'm making a bash script in which I need to print a number while it's incremented like this:
0000
0001
0002
0003
0004
I have made this but is not working:
#!/bin/bash
i=0
pass[0]=0
pass[1]=0
pass[2]=0
pass[3]=0
for i in $(seq 1 9)
pass[3]="$i"
echo ${pass[*]}
done
I paste the script on cli and i get this.
$ ~ #!/bin/bash
$ ~ i=0
$ ~ pass[0]=0
$ ~ pass[1]=0
$ ~ pass[2]=0
$ ~ pass[3]=0
$ ~ for i in $(seq 1 9)
> pass[3]="$i"
bash: error sintáctico cerca del elemento inesperado `pass[3]="$i"'
$ ~ echo ${pass[*]}
0 0 0 0
$ ~ done
bash: error sintáctico cerca del elemento inesperado `done'
$ ~
for i in ...is missing the correspondingdo- e.g.for i in $(seq 1 9); do pass[3]="$i"; done