The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Check if parameter passes in contains certain string bcunney Shell Programming and Scripting 9 08-15-2008 10:54 AM
what's wrong with my bash script? ikk Shell Programming and Scripting 4 02-22-2008 12:55 AM
Connecting to Oracle from Shell..What Am I doing Wrong dzyr4tt Shell Programming and Scripting 1 12-21-2006 01:05 AM
new to shell scripting: whats wrong with my if loop stride6 Shell Programming and Scripting 10 07-20-2006 11:18 AM
Wrong Shell Invoking My Script On Linux kowrip Shell Programming and Scripting 3 09-10-2003 11:18 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-06-2003
andyj andyj is offline
Registered User
  
 

Join Date: Jul 2003
Location: UK
Posts: 27
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.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:30 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0