Skip to content
Advertisement

bash: [: 1+1: integer expression expected

I have a main directory with 40 subdirectories with names [Set 1], [Set 2][Set 40], each containing 20 wallpapers with name 1.jpg, 2.jpg, … 20.jpg. I want to move all these wallpapers to the main directory and rename them as 1.jpg, 2.jpg800.jpg. I wrote the following Bash script but getting error.

JavaScript
JavaScript

Where am I making a mistake?

Advertisement

Answer

In bash you enclose mathmatical/arithmetical operations in $(()), so

JavaScript

Should do what you want..

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement