to me it seems quite hazardious to use the ">" character like this. if you for instance write:
convert -resize 640x480> source.png dest.jpg
then on windows this will actually overwrite the source file with empty data, because the ">" is interpreted as a pipe to stdout.
i know applying doublequotes, eg. ** -resize "640x480">" ** but this causes yet new problems when using imagemagick from php, where the strict mode enforces escaping of its own, leaving me with double escaping. if i remove my own quotes, then it doesn't work on windows (the source file is overwritten like described above).
i have browsed the imagemagic manuals and there seems to be no alternative way to enforce this option.
i would strongly encourage the developer to create a new, ordinary "-option" based on alphabetical characters for all the ">", "<", "!" and "@" options, as this would seem safer and less prone to mistakes.
or let me know if such methods already do exist. thanks.
">" character causes problems
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: ">" character causes problems
The > does not have to be at the end of the option, just anywhere within the option (except in the middle of a number). Try adding it to the front if you are worried about this.
Unix shells by the way will not confuse the > when it is hard up against an previous argument, it is only the horrible windows DOS that has these problems.
Also get use to using quotes, There are a lot more 'gottas' that just that for BOTH systems, regardless of what characters are picked. UNIX shells for example use just about every shifted number symbol for one purpose or another so it does not matter what character is picked you still get into trouble.
Worse still the '!' can not be escaped with simple quoting as it still represents a history expandsion in most mordern programming shells. It almost always requires a backslash escape in all situations.
All in all. There is not much choice about it. Quoting is a lot simplier than trying to add more 'special' characters to avoid the problem.
PS: I have written programs in lots of shell like languages of 18 years, and even written scripts that were designed to work on ALL unix like systems, from Citrix, to MacOSX, HPUS, AIX, as well as more modern machines. At least things are becomming more consistant.
The worst aspect of the use of special charcaters I have every seen, is a backslash storm. Imagine having to write 16 backslashes just so the final output of the program is a single simple character. It happens!
Unix shells by the way will not confuse the > when it is hard up against an previous argument, it is only the horrible windows DOS that has these problems.
Also get use to using quotes, There are a lot more 'gottas' that just that for BOTH systems, regardless of what characters are picked. UNIX shells for example use just about every shifted number symbol for one purpose or another so it does not matter what character is picked you still get into trouble.
Worse still the '!' can not be escaped with simple quoting as it still represents a history expandsion in most mordern programming shells. It almost always requires a backslash escape in all situations.
All in all. There is not much choice about it. Quoting is a lot simplier than trying to add more 'special' characters to avoid the problem.
PS: I have written programs in lots of shell like languages of 18 years, and even written scripts that were designed to work on ALL unix like systems, from Citrix, to MacOSX, HPUS, AIX, as well as more modern machines. At least things are becomming more consistant.
The worst aspect of the use of special charcaters I have every seen, is a backslash storm. Imagine having to write 16 backslashes just so the final output of the program is a single simple character. It happens!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/