Skip to content

Instantly share code, notes, and snippets.

@SlaunchaMan
Last active July 17, 2018 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SlaunchaMan/94aa3bbe52df96cb9511ea6059647e5e to your computer and use it in GitHub Desktop.
Save SlaunchaMan/94aa3bbe52df96cb9511ea6059647e5e to your computer and use it in GitHub Desktop.
Bash script to run Gyb on the given input files or file lists.
GYB_PATH="${SRCROOT}/Vendor/gyb/gyb"
function gyb {
file=$1
if [ ${file: -4} == ".gyb" ]; then
"${GYB_PATH}" --line-directive '' -o "${file%.gyb}" "$file";
fi
}
if [ $SCRIPT_INPUT_FILE_COUNT -ne 0 ]; then
for i in $(seq 0 $(expr $SCRIPT_INPUT_FILE_COUNT - 1)); do
inputFileVar="SCRIPT_INPUT_FILE_${i}"
inputFile="${!inputFileVar}"
gyb $inputFile
done
fi
if [ $SCRIPT_INPUT_FILE_LIST_COUNT -ne 0 ]; then
for i in $(seq 0 $(expr $SCRIPT_INPUT_FILE_LIST_COUNT - 1)); do
inputFileListVar="SCRIPT_INPUT_FILE_LIST_${i}"
inputFileList="${!inputFileListVar}"
cat "${inputFileList}" | while read inputFile; do
gyb $inputFile
done
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment