SOLVED: Error: unrecognised option '-P' error/import.c/ImportImageCommand/1275

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
gareththomasnz
Posts: 5
Joined: 2016-01-06T06:29:10-07:00
Authentication code: 1151

SOLVED: Error: unrecognised option '-P' error/import.c/ImportImageCommand/1275

Post by gareththomasnz »

I have a script that takes screenshots of linux man pages as they show in the console

Code: Select all

try(){
   clear
   timeout 0.2 $1 
   re=$?
   echo trying $1>>log.txt
   echo result is $re>>log.txt
   if [ ! $re -eq 127 ]; then
       sleep 0.2
       import -window osboxes@osboxes:~/Downloads/Parser\ Project\Code/iteration\ 3 iter3/$1.png
       echo $1 captured>>log.txt
   fi
}
try man\ \-P\ cat\ AB
try man\ \-P\ cat\ ABRT\-ACTION\-ANALYZ
try man\ \-P\ cat\ ABRT\-ACTION\-ANALYZ
try man\ \-P\ cat\ ABRT\-ACTION\-ANALYZ

My true list of commands is quite long. Without \-P\ cat\ it wont display the man files. In its present form it does display each man file but wont take the screen shot of each.

Error: unrecognised option '-P' error/import.c/ImportImageCommand/1275

Any idea how I should correct it - I have no clue.
Last edited by gareththomasnz on 2016-01-06T16:18:15-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Error: unrecognised option '-P' error/import.c/ImportImageCommand/1275

Post by snibgo »

Your $1 will contain spaces. I expect they are passed to the command line, so your import command ends with:

Code: Select all

iter3/man -P cat AB.png
If this should be a filename, you should probably quote it.
snibgo's IM pages: im.snibgo.com
gareththomasnz
Posts: 5
Joined: 2016-01-06T06:29:10-07:00
Authentication code: 1151

Re: Error: unrecognised option '-P' error/import.c/ImportImageCommand/1275

Post by gareththomasnz »

Sorry can you elaborate more clearly?

The files have to be given the name of the command that is being run. Over 1000 of them. If I run it without man - just the raw command it saves & names the files OK.

But I need to take a screen shot of the man file output for each command & give it a relevant name. Not manually of course. I'm not familiar at all with shell scripting to make it difficult.
Last edited by gareththomasnz on 2016-01-06T15:52:37-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Error: unrecognised option '-P' error/import.c/ImportImageCommand/1275

Post by snibgo »

I'm not a bash expert. If you include "-debug all" in the convert command, IM will tell you the arguments it sees.
snibgo's IM pages: im.snibgo.com
gareththomasnz
Posts: 5
Joined: 2016-01-06T06:29:10-07:00
Authentication code: 1151

Re: Error: unrecognised option '-P' error/import.c/ImportImageCommand/1275

Post by gareththomasnz »

Debug just gives that error about -P
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Error: unrecognised option '-P' error/import.c/ImportImageCommand/1275

Post by snibgo »

The top of the debug output will have something like this:

Code: Select all

 Command line: c:\im\ImageMagick-6.9.2-5-Q16\convert {-debug} {all} {rose:} {r.png}
snibgo's IM pages: im.snibgo.com
gareththomasnz
Posts: 5
Joined: 2016-01-06T06:29:10-07:00
Authentication code: 1151

Re: Error: unrecognised option '-P' error/import.c/ImportImageCommand/1275

Post by gareththomasnz »

Working now:

Code: Select all

try(){
   clear
   timeout 0.2 man -P cat $1 
   re=$?
   echo trying $1>>log.txt
   echo result is $re>>log.txt
   if [ ! $re -eq 127 ]; then
       sleep 0.2
       import -window osboxes@osboxes:~/Downloads/Parser\ Project\Code/iteration\ 3 iter3/$1.png
       echo $1 captured>>log.txt
   fi
}
try AB
try ABRT\-ACTION\-ANALYZ
try ABRT\-ACTION\-ANALYZ
try ABRT\-ACTION\-ANALYZ
gareththomasnz
Posts: 5
Joined: 2016-01-06T06:29:10-07:00
Authentication code: 1151

Re: Error: unrecognised option '-P' error/import.c/ImportImageCommand/1275

Post by gareththomasnz »

So the man command was inserted after the timeout not in the list of commands - not in the import either
Post Reply