Here is a more fully functional script that I used for the same operation:
#!/bin/bash # Argument = -o output_dir -i input_dir usage() { cat << EOF usage: $0 [options] This script generates strings files from all xibs in a given directory. OPTIONS: -h Show this message -i Input directory where XIBs are located [./] -o Output directory where .strings files will be generated EOF } INPUT_DIRECTORY="." OUTPUT_DIRECTORY="." while getopts "hi:o:" OPTION do case $OPTION in h) usage exit 1 ;; i) INPUT_DIRECTORY=$OPTARG ;; o) OUTPUT_DIRECTORY=$OPTARG ;; ?) usage exit ;; esac done if [[ -z $INPUT_DIRECTORY ]] || [[ -z $OUTPUT_DIRECTORY ]] then usage exit 1 fi # do the generation find $INPUT_DIRECTORY -name "*.xib" | while read FILENAME; do XIBNAME=$(basename "$FILENAME") XIBNAME="${XIBNAME%.*}" ibtool --generate-strings-file $OUTPUT_DIRECTORY/$XIBNAME.strings $FILENAME done
Ben lachman
source share