【发布时间】:2012-04-10 23:42:53
【问题描述】:
我得到了一个用于将文件从沙盒传输到主机的 bash 脚本。 沙盒目录中的文件只有在它们更年轻时才会被传输,这意味着它们之前已经被“触及”过。不幸的是,cygwin在windows下造成了麻烦,所以我需要另一种语言的脚本,或者我需要在windows下像cygwin一样工作的东西。 该脚本只有大约 20 行,但我不知道如何将其转换为另一种语言(尤其是 touch、make、gcc、getopts、set -e 等命令) 如果有人发现这很容易做到并转换它,我会很高兴:
# 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 $@
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
【问题讨论】:
-
为什么每个人都给我不好的名声而不是帮助我?
-
因为这不是一个“为我工作”的网站。你需要提出更具体、更容易回答的问题。阅读the FAQ
-
有 Windows bash 端口,例如在 cygwin,msys 中。
标签: perl bash powershell vbscript batch-file