我得到了一個bash腳本,用於將文件從沙箱傳輸到主機。 沙盒目錄中的文件只有在更年輕時纔會被傳輸,這意味着它們之前已被「觸及」。不幸的是,cygwin在windows下引起麻煩,所以我需要另一種語言的腳本,或者我需要一些像Windows下的cygwin一樣的東西。 該腳本只有20行左右,但我沒有任何線索如何將其轉換爲另一種語言(特別是像觸摸,使命令,海灣合作委員會,getopts,設置-e命令) 如果有人發現這一點,我會很高興很容易做到,並將其轉換:將Bash腳本轉換爲Perl/VBS /任何其他Windows兼容語言
# EXITING SCRIPT IF ERROR OCCURS
set -e
FORCE=false
JUSTPRINT=
# if parameter -f is given, force to transfer all files(no matter if new or not)
# if -n is given checking files
while getopts fn opt 2>/dev/null
do
case $opt in
f) FORCE=true ;;
n) JUSTPRINT="-n" ;;
?) ;;
esac
done
# deleting parsed options from command line
shift `expr $OPTIND - 1`
# refresh files that came with -f
if [ \($FORCE = true \) -a \($# -gt 0 \) ]
then
touch -c [email protected]
fi
# Targets (dummy files for timestamp)
TARGETS=`for filename
do
if [ -f $filename ]
then
echo "../transport_dummies/\`basename $filename\`.dum"
else
echo "$filename"
fi
done`
# call script directory
echo $0
cd `dirname $0`
# creating sysfilterL.exe
if [ ! -f sysfilterL ]
then
echo "sysfilterL is created."
gcc sysfilter.c -o sysfilterL
fi
# Call Transport-Makefile with target
if [ $# -gt 0 ]
then
make --warn-undefined-variables $JUSTPRINT -f transportDE.mk reset $TARGETS
send_queueed
else
make --warn-undefined-variables $JUSTPRINT -f transportDE.mk
fi
爲什麼每個人都給我壞代表而不是幫助我? – Sven 2012-03-27 13:10:17
,因爲這不是「爲我工作」的網站。你需要提出更具體的,可回答的問題。閱讀[常見問題](http://stackoverflow.com/faq) – 2012-03-27 13:38:03
有Windows bash端口,例如在cygwin,msys。 – 2012-03-28 08:53:05