хто-небудь може мені допомогти, перетворивши цей скрипт оболонки на bash script pl.
мій скрипт оболонки такий
#!/bin/bash
IN="ifa_in_B2C=ifa_inB2C;ifa_in_ERP_Soap=ifa_inERP;sm=sm_main;tp=tp_main;trp=trp_main;usr=usr_main;wl=wl_main;pe_notification_email=pe_email;pe_notification_sms=pe_sms;pe_group_calc=pe_group;ifa_out_sms=ifa_outSMS;ifa_out_email=ifa_outEmail;ifa_out_oxiB2C=ifa_outOxi;ifa_out_OMTS=ifa_outOMTS;log=log_main;sys=sys_main;ifa_sys=ifa_sys;sm_sys=sm_sys;sp=sp_main;usr_sys=usr_sys;cache_reload=cache_reload"
export GOPATH=C:/Users/user/Desktop/nxtxn-b2c
export PATH=$PATH:C:/Users/user/Desktop/nxtxn-b2c/srcC:/Users/user/Documents/nxtxn-b2c/src:C:/Go/bin
arr=$(echo $IN | tr ";" "\n")
echo "No of Arguments Passed is "$#
if [ "$#" -gt "2" ] || [ "$#" == "2" ]; then
DATE=`date +%Y-%m-%d:%H:%M:%S`
BUILD_ARG=""
echo $DATE
if [ "$3" == "buildversion" ]; then
echo "ENTER the Version no"
read VERSION_NO
echo "ENTER Version Description"
read VERSION_DESP
if [ "$VERSION_NO" == "" ]; then
$BUILD_ARG=""
else
TEMP="\"-X main.version $VERSION_NO -X main.version_date $DATE -X main.version_desc $VERSION_DESP\""
echo $TEMP
BUILD_ARG="-ldflags "
BUILD_ARG=$BUILD_ARG$TEMP
fi
else
echo "Wrong 3rd argument: Use buildversion to create version tags"
fi
echo "Build Arguments : "$BUILD_ARG
echo "METHOD:$1 SUBSYS:$2"
echo "GOPATH : $GOPATH"
for subsys in $arr
do
IFS='=' read -a arr_tmp <<< "$subsys"
echo "%%%%%%%%%%%%%%%%%%%%%%%%% START %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
echo "SUBSYS: ${arr_tmp[0]}"
subsys_pkg=${arr_tmp[0]}"_pkg"
echo "$subsys_pkg"
subsys_main=${arr_tmp[0]}"_main"
if [[ ${arr_tmp[0]} != pe* ]] ; then
main_path="$GOPATH/src/${arr_tmp[0]}/$subsys_main"
else
main_path="$GOPATH/src/pe/${arr_tmp[0]}/$subsys_main"
fi
if [[ ${arr_tmp[0]} != pe* ]] ; then
cd "$GOPATH/src/${arr_tmp[0]}/$subsys_pkg"
else
cd "$GOPATH/src/pe/${arr_tmp[0]}/$subsys_pkg"
fi
if [ "$1" == "build" ]; then
if [ "$2" == "all" ]; then
cd $main_path
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
eval go install -v -x $BUILD_ARG
ret_cmd=$?
error_msg="ERROR : Failed to run the build command!"
if [ $ret_cmd != 0 ]; then
echo "$error_msg"
exit;
fi
mv $GOPATH/bin/${arr_tmp[0]}"_main" $GOPATH/bin/${arr_tmp[1]}
echo "BUILT and INSTALLED : ${arr_tmp[0]}"
elif [ "$2" == ${arr_tmp[0]} ]; then
cd $main_path
echo "***********%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%***********"
eval go install -v -x $BUILD_ARG
ret_cmd=$?
error_msg="ERROR : Failed to run the build command!"
if [ $ret_cmd != 0 ]; then
echo "$error_msg"
exit;
fi
mv $GOPATH/bin/${arr_tmp[0]}"_main" $GOPATH/bin/${arr_tmp[1]}
echo "BUILT and INSTALLED : ${arr_tmp[0]}"
break
78,1-8 40%
fi
elif [ $1 == "cleanbuild" ]; then
if [ $2 == "all" ]; then
echo "********************** CLEAN ***************************"
cd $main_path
go clean -i -x
echo "****************************************************************"
eval go install -v -x $BUILD_ARG
ret_cmd=$?
error_msg="ERROR : Failed to run the build command!"
if [ $ret_cmd != 0 ]; then
echo "$error_msg"
exit;
fi
mv $GOPATH/bin/${arr_tmp[0]}"_main" $GOPATH/bin/${arr_tmp[1]}
#eval go install -v -x $BUILD_ARG
echo "CLEANED and INSTALLED : ${arr_tmp[0]}"
elif [ $2 == ${arr_tmp[0]} ]; then
echo "********************** CLEAN ***************************"
cd $main_path
go clean -i -x
echo "%%%%%%%*************************************************%%%%%%%%"
# eval go build -v -x $BUILD_ARG
eval go install -v -x $BUILD_ARG
ret_cmd=$?
error_msg="ERROR : Failed to run the build command!"
if [ $ret_cmd != 0 ]; then
echo "$error_msg"
exit;
fi
mv $GOPATH/bin/${arr_tmp[0]}"_main" $GOPATH/bin/${arr_tmp[1]}
echo "CLEANED and INSTALLED : ${arr_tmp[0]}"
break
fi
elif [ $1 == "clean" ]; then
if [ $2 == "all" ]; then
echo "********************** CLEAN ONLY ***************************"
cd $main_path
go clean -i -x
echo "****************************************************************"
echo "CLEANED : $subsys"
elif [ $2 == ${arr_tmp[0]} ]; then
echo "********************** CLEAN ***************************"
cd $main_path
go clean -i -x
echo "%%%%%%%*************************************************%%%%%%%%"
echo "CLEANED and INSTALLED : $subsys"
break
fi
else
echo "wrong first argument. Use build|cleanbuild"
break
fi
done
else
echo "Wrong number of arguments. Use build|cleanbuild with subsystem to build"
fi
Примітка: Ваш
—
DavidPostill
export PATH...
заява порушена.
@DavidPostill hah, дуже зламаний дійсно, так багато способів. Цікаво, що він робить з Баш на вікна, якщо він навіть не знає, як використовувати його в першу чергу ...
—
Cestarian
потім, як запустити його в системі Windows. коли я запускаю його bash script.sh, m отримую помилку
—
mpower
`m getting error` ... Згадавши, яка помилка може допомогти ....
—
Hennes
#!/bin/bash
- це вже скрипт, запущений bash. Чому потрібне перетворення?