Simple bash/automator question

Discussion in 'Mac Programming' started by jimmy43, Nov 20, 2009.

  1. jimmy43 macrumors member

    Apr 9, 2008
    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
    echo "Minifying $cfile..."
    java -jar $YUICOMPRESSOR --type css $ARGS $cfile -o $cfilemini
    cat $cfilemini >> compressed.css

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

  2. jimmy43 thread starter macrumors member

    Apr 9, 2008
    just to be clear, this works when saved as a bash script, but doesnt work as an automator app/script.
  3. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    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.

Share This Page