I'm trying to count pages of PDF documents in a directory - which works fine except I cannot get the counter variable to increase. In the directory are two documents with 1 Page and 4 Pages. The return of my below script is:
1
4
why isn't it incrementing $i ?
#!/usr/local/bin/fish
set i 0
for pdf in *.pdf
set i (math i + (pdfinfo $pdf | grep Pages | awk '{print $2}'))
echo $i
end
Found the issue at hand - whitespace made it problematic...
By doing **.pdf it gets recursive through all folders...
#!/usr/local/bin/fish
set i 0
for pdf in **.pdf
set i (math $i+(pdfinfo $pdf | grep Pages | awk '{print $2}'))
echo $i
end