From 201e5a99b93a8bf224ac92964d3617abed72b70a Mon Sep 17 00:00:00 2001 From: zboris12 Date: Sun, 24 Mar 2024 18:44:00 +0900 Subject: [PATCH] Fixed build error of "Syntax error: redirection unexpected". --- build.sh | 79 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/build.sh b/build.sh index 0ab247e..a68d0c7 100755 --- a/build.sh +++ b/build.sh @@ -1,47 +1,48 @@ -# !/bin/bash +# !/bin/sh # set -x -OUTFLDR=dist -if [ -d ${OUTFLDR} ] -then - rm -f ${OUTFLDR}/* -else - mkdir ${OUTFLDR} -fi - -GCCOPT="--charset UTF-8 --compilation_level SIMPLE_OPTIMIZATIONS --warning_level VERBOSE" -GCCEXT="--externs closure/google-ext.js --externs closure/forge-ext.js --externs closure/pdflib-ext.js --externs closure/zb-externs.js" -jss="" -while read js -do - if [ -n "${js}" ] +echo " +zgacertsutil.js +zgapdfcryptor.js +zgapdfsigner.js +zgaindex.js +" | { + OUTFLDR=dist + if [ -d ${OUTFLDR} ] then - c=$(echo "${js}" | cut -b1) - if [ "$c" != "#" ] + rm -f ${OUTFLDR}/* + else + mkdir ${OUTFLDR} + fi + GCCOPT="--charset UTF-8 --compilation_level SIMPLE_OPTIMIZATIONS --warning_level VERBOSE" + GCCEXT="--externs closure/google-ext.js --externs closure/forge-ext.js --externs closure/pdflib-ext.js --externs closure/zb-externs.js" + jss="" + while read js + do + if [ -n "${js}" ] then - outf="${OUTFLDR}/_${js}" - sed -e "s/\/\/Only for nodejs Start\/\//\/*/g" -e "s/\/\/Only for nodejs End\/\//*\//g" "lib/${js}" > "${outf}" - if [ $? -eq 0 ] + c=$(echo "${js}" | cut -b1) + if [ "$c" != "#" ] then - echo "Created js file: ${outf}" - jss="${jss} --js ${outf}" - else - echo "Failed create js file: ${outf}" - exit 10 + outf="${OUTFLDR}/_${js}" + sed -e "s/\/\/Only for nodejs Start\/\//\/*/g" -e "s/\/\/Only for nodejs End\/\//*\//g" "lib/${js}" > "${outf}" + if [ $? -eq 0 ] + then + echo "Created js file: ${outf}" + jss="${jss} --js ${outf}" + else + echo "Failed create js file: ${outf}" + exit 10 + fi fi fi + done + npx google-closure-compiler ${GCCOPT} ${GCCEXT} ${jss} --js_output_file ${OUTFLDR}/zgapdfsigner.min.js + if [ $? -ne 0 ] + then + echo "google-closure-compiler failed." + exit 20 fi -done <<< " -zgacertsutil.js -zgapdfcryptor.js -zgapdfsigner.js -zgaindex.js -" -npx google-closure-compiler ${GCCOPT} ${GCCEXT} ${jss} --js_output_file ${OUTFLDR}/zgapdfsigner.min.js -if [ $? -ne 0 ] -then - echo "google-closure-compiler failed." - exit 20 -fi - -exit 0 + exit 0 +} +exit $?