Register FAQ/Rules Forum Spy Search Today's Posts Mark Forums Read

Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate.

 
Go Back   Mac Forums > Apple Software > Mac Programming
TouchArcade.com - iPhone Game Reviews and News

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 20, 2009, 07:35 PM   #1
jimmy43
macrumors newbie
 
Join Date: Apr 2008
Simple bash/automator question

I am setting up a script which minifies and concatenates a bunch of css/js files.

So in my script i have this:

csslist=`find $1 -type f -name \*.css -a \! -name \*.min.css`
for cfile in $csslist
do
cfilemini="${cfile%.css}.min.css"
echo "Minifying $cfile..."
java -jar $YUICOMPRESSOR --type css $ARGS $cfile -o $cfilemini
cat $cfilemini >> compressed.css
done

but the cat $cfilemini >> compressed.css doesn't work. Are you allowed redirection in this type of script? It's just bash ...

thanks!
jimmy43 is offline   Reply With Quote
Old Nov 20, 2009, 07:46 PM   #2
jimmy43
Thread Starter
macrumors newbie
 
Join Date: Apr 2008
just to be clear, this works when saved as a bash script, but doesnt work as an automator app/script.
jimmy43 is offline   Reply With Quote
Old Nov 21, 2009, 02:02 PM   #3
chown33
macrumors 6502a
 
Join Date: Aug 2009
Quote:
Originally Posted by jimmy43 View Post
java -jar $YUICOMPRESSOR --type css $ARGS $cfile -o $cfilemini
cat $cfilemini >> compressed.css
In both commands, $cfilemini is unquoted. So are $YUICOMPRESSOR and $cfile. Think about what happens if any of those values has spaces embedded in the pathname.

As a test, run your shell script using a pathname that contains embedded spaces.

You might also describe exactly what happens when it doesn't work. Post any error messages, unexpected files, missing files, etc.
chown33 is offline   Reply With Quote

Reply

Mac Forums > Apple Software > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 07:03 PM.

Mac News | Mac Rumors | iPhone Game Reviews | iPhone Apps

Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 2002-2010, MacRumors.com, LLC