I want to write a script that renames the pages of a DJVU file recursively. From http://djvu.sourceforge.net/doc/man/djvused.html I know that the command to do that on a single page (say call page 5 of the bundle with name 6) is
djvused file.djvu -e 'select 5; set-page-title 6; save'
But then I have troubles when trying to do it recursively, namely running the script
./for.sh
which is given by
for (( i=12; i<=823; i++ ))
do
djvused file.djvu -e 'select $i; set-page-title $((i-10)); save'
done
The error I get is due to the program being unable to understand $i as a number, instead of an expression. I think this is related to my small knowledge of shell scripts and djvused.
Could anyone tell me how to modify it so that it works?
You should quote it properly with double-quotes. Using single quotes would not allow variables to be expanded and remain as literal form.
As noted about single quotes:
Whereas on double quotes: