Bash Scripters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fris
    Too lazy to set a custom title
    • Aug 2002
    • 55679

    #1

    Bash Scripters

    Anyone think of a shorter way of doing this?

    it converts a directory of ttf and otf fonts to cufon (also removes capitals and spaces)

    Code:
    #!/bin/bash
    
    for f in *.otf *.ttf; do 
    php convert.php "$f" -u "U+??" > $(echo ${f%.*}.font.js | tr ' [A-Z]-' '_[a-z]_' | tr -s _);
    done
    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.
  • fris
    Too lazy to set a custom title
    • Aug 2002
    • 55679

    #2
    or i could use shopt

    Code:
    #!/bin/bash
    
    shopt -s extglob; 
    for f in *.otf *.ttf; do 
    out=${f%.*}.font.js out=${out,,} out=${out//+([[:blank:]-])/_}; php convert.php "$f" -u 'U+??' > "$out";
    done
    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

    Comment

    • KillerK
      Confirmed User
      • May 2008
      • 3406

      #3
      What's wrong with the way you are doing it?

      Comment

      • fris
        Too lazy to set a custom title
        • Aug 2002
        • 55679

        #4
        Originally posted by KillerK
        What's wrong with the way you are doing it?
        nothing, did a test shopt runs faster then the latter.
        Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

        Comment

        Working...