Sponsored Content
Top Forums Shell Programming and Scripting Bash passes flags to shell wrong Post 38072 by andyj on Sunday 6th of July 2003 09:22:36 PM
Old 07-06-2003
Bash passes flags to shell wrong

Hi, first post, so hello to all.
I have a Bash scripting problem that is driving me a bit nutty.

It involves a program called 'convert' which is part of the ImageMagick collection.
Normal usage from the commandline is:

$ convert -resize 120x120 inputfile.jpg outputfile.jpg

This is working just fine (from the command line)


However while inside a shellscript everything seems to go weird, this I beleive should work...

echo converting thumbnails
for searchfile in ./*.jpg
do
echo processing
echo $searchfile
convert ‐resize 120x120 "$searchfile" "$tndir/$searchfile"
done

but I get instead

convert: Unable to open file (‐resize) [No such file or directory].
convert: Unable to open file (120x120) [No such file or directory].

I have tried strong quotes to bind the arguments tighter

convert '‐resize 120x120' "$searchfile" "$tndir/$searchfile"

I have tried opening it in a subshell

(convert ‐resize 120x120 "$searchfile" "$tndir/$searchfile")

But nothing will convince it that -resize 120x120 is an argument not a file!!!

The file arguments themselves are fine $searchdir and $tndir are interpreted right. Indeed I get unaltered files dumped in the destination directory which kind of confirms that its just the -resize flag that isn't getting heard.
I have read the man for this program over many times and I'm sure i'm using it correctly.

Any ideas on how to crack this? Many thanks to any takers.
 

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

what's wrong with my bash script?

hi, please point out what's wrong with my script. im feeding it a list containing fqdn, sit should ssh into each and verify that atleast one of its virtual backup ip resolves into one of its virtual hostnames .. anyway the objective shows in the script... however, im having problems in the ... (4 Replies)
Discussion started by: ikk
4 Replies

2. Shell Programming and Scripting

Check if parameter passes in contains certain string

Hi Guys, I am writing a Unix script which accepts a directory path as parameter $1 so something like /user5.data/WA/01 will be passed in. I want to determine if the directory path passed in contains "WA" as above (because then I need to do something specific if it does) What is the... (9 Replies)
Discussion started by: bcunney
9 Replies

3. Shell Programming and Scripting

Please help to fingure out what wrong with my tomcat restarting bash script

Hi, I am a nbee to Unix, I have used following script to check my tomcat is running or not and restart if it down. but actually it restart my tomcat each time running even my tomcat still running fine: Script that can run a check and perform an action if the check fails ... (1 Reply)
Discussion started by: quyennd
1 Replies

4. AIX

find {start} -ls - Two Passes?

I have a "find {start} -ls" command listing all files and dirs in on the whole filesystem. As part of this it lists locations that contain temporary files and, sometimes when executing, it identifies a file but produces an ERROR when trying to list it. ERROR thrown: find: bad status--... (2 Replies)
Discussion started by: apiggott
2 Replies

5. Shell Programming and Scripting

Bash conditional | getting logic wrong?

I have a file cat <<EOF > /tmp/test Line one Line two Line three EOF Now I am trying to get the exit stat ($?) of 1 if any text is found and 0 if any text is not found using grep, i.e. just reversing the exit status of grep # (snippet 1) this one is not working!!! retval $?... (4 Replies)
Discussion started by: the_gripmaster
4 Replies

6. Shell Programming and Scripting

What's wrong with my bash code?

I want to let sleep 3 in the background and echo $i pkglists="a b c d e f g" f() { local i set -- $pkglists && ((i +=2)) && sleep 3 &;echo $i } f (3 Replies)
Discussion started by: yanglei_fage
3 Replies
Magick-Config(1)					      General Commands Manual						  Magick-Config(1)

NAME
Magick-config - get information about the installed version of ImageMagick SYNOPSIS
Magick-config [--cflags] [--cppflags] [--exec-prefix] [--ldflags] [--libs] [--prefix] [--version] DESCRIPTION
Magick-config prints the compiler and linker flags required to compile and link programs that use the ImageMagick Application Programmer Interface. EXAMPLES
To print the version of the installed distribution of ImageMagick, use: Magick-config --version To compile a program that calls the ImageMagick Application Programmer Interface, use: cc `Magick-config --cflags --cppflags --ldflags --libs` program.c OPTIONS
--cflags Print the compiler flags that were used to compile libMagick. --cppflags Print the preprocessor flags that are needed to find the ImageMagick C include files and defines to ensure that the ImageMagick data structures match between your program and the installed libraries. --exec-prefix Print the directory under which target specific binaries and executables are installed. --ldflags Print the linker flags that are needed to link with the ImageMagick library. --libs Print the linker flags that are needed to link a program with libMagick. --version Print the version of the ImageMagick distribution to standard output. LICENSE
See http://www.imagemagick.org/script/license.php. AUTHORS
John Cristy, ImageMagick Studio LLC ImageMagick 2 May 2002 Magick-Config(1)
All times are GMT -4. The time now is 10:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy