I have a Linux .bsh script, which I need to run on a Windows 7, an开发者_如何学Cd I’m having some difficulties with creating the script. I would like a script so I can run it in my cmd in windows or if the script could output to a file.
The .bsh script looks as following:
for ((r=0; r <$[0]; r++))
netcat localhost 4444 < $[1] $
done
wait
I’ve two parameters in the .bsh script $[0]
and $[1]
and if possible I would like to keep them. The other important thing is the “$”
in the end of the netcat script. This is, in Linux, to spawn a process / thread and it is important that I can do this because I’ve some test I need to run with and without it and compare it.
The last thing is, that when I’m running the .bsh script on Linux, I use following command before the filename: TIME
so I can get the time for running the script. If that is possible, as an output to a file or the console, that would really help me.
If you need any other information, please do ask.
Sincerely
Mestika
Unfortunately, the Windows commandline is nowhere near as powerful as the BASH shell; don't expect to achieve the same thing in a Windows *.bat script as you do in a BASH shell script, without lots of pain and headaches. For this situation, I have two suggestions: either download and install Cygwin, and simply use the original shell script with Cygwin's copy of BASH, or reimplement the script using Python, which is far more expressive than the Windows commandline and yet is incredibly portable. Also, I would add that you are missing a "do" in your script. Are you sure your script works on UNIX?
精彩评论