2

I want to convert single page from 333 PDF pages file.

I have tried with this command: convert Binder3.pdf[12] image.jpg, but for some reason I am getting this error:

zsh: no matches found: Binder3.pdf[12]

The name of the file is correct. I double check it. Why is it not working? I am using ImageMagick 6.9.10-8 Q16 x86_64 20180723

3
  • it worked. can u post it as an answer?
    – Dimitar
    Dec 27, 2018 at 14:18
  • yes I am using zsh thanks it worked this way as well!
    – Dimitar
    Dec 27, 2018 at 14:20
  • 1
    Please see answer below Dec 27, 2018 at 14:25

1 Answer 1

5

[12] is a shell glob expression - in the default bash shell, if it doesn't match anything in the current directory, then the string Binder3.pdf[12] will be passed unmolested to the convert program, however in zsh the default is to error out on nomatch (equivalent to the bash failglob shell option).

You can get bash-like behavior in zsh by setting setopt +o nomatch however this may result in unexpected behavior if there is a glob match - it's better to force the shell (whichever one) to treat the characters literally e.g.

convert Binder3.pdf\[12\] image.jpg

or

convert "Binder3.pdf[12]" image.jpg
2
  • and if i set setopt +o nomatch to unset it i need to execute setopt -o nomatch?
    – Dimitar
    Dec 27, 2018 at 14:29
  • 1
    @Dimitar yes that's correct Dec 27, 2018 at 14:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .