This so simple script is failing :
#!/bin/bash n=1 printf -v fn \"%05d\" $n echo $fn
with
3: printf: Illegal option -v
As other answers tell you that older BASH version versions don't support printf -v but here is what you can do that in older BASH to set fn:
printf -v
fn
#!/bin/bash n=1 fn=$(printf "%05d" "$n") echo "$fn"