I am trying to use a batch file to automatically execute a bash script with no luck this far.
The batch script looks like this:
I have also tried this:
Needless to say that the windows box has Cygwin installed on it.
Any ideas/suggestions are very much appreciated!
Please check :
Is the test.sh in unix file format ?
Is your PATH on Windows configured properly to include CYGWIN/bin at the end ?
CYGWIN being path where you installed cygwin default being c:\cygwin\bin
If CYGWIN is installed in c:\cygwin\bin and you're trying to run your script that is installed as c:\cygwin\bin\test.sh, is CYGWIN being confused by your test.sh and the CYGWIN test utility both being located in the same directory?
When CYGWIN is installed isn't bash set to run files with .sh as a file extension? If so, would trying to run test from Windows try to invoke c:\cygwin\bin\test or c:\cygwin\bin\test.sh?
I actually came to realized that in CygWin I must use gawk instead
So I decided to run gawk using CMD. Everything is fine but when I tried to read a variable from a file using a gawk script inside other gawk script I get a warning message.
This is the script I am using:
This is the warning I am getting:
I tried to escape the path using quotes, double quotes or backslashes with no luck:
I just cannot figure it out. Is there any other way to read the variable from the file within gawk?
Please explain in English what you are trying to do.
I am calculating volumes based on concentrations. Here, I am "translating" a file that is being generated by one documentation system into a CSV file that will be understood by a robotic unit. The controllers are Windows based boxes (connected by a LAN cable). The idea is to have a BATCH file that will automatically translate and feed the CSV file into the computer controlling the robotic unit
Quote:
Please show us the contents of the file minimum.txt.
The minimum file will contain a number that will change from run to run -the user will not have access to that file. Something like this:
I am outputting that number using the following script:
I am using the above script to defince variable est
The rest of my code divides the data generated by the documentation system and multiplies it for a constant (15), printing the original concentration value and the calculated volume
The Output file contains hundreds of entries and looks like this:
The Output2 file should look like this:
PS. I could do it with not many issues in CygWin but using BATCH will be much easier. Fetching the variable from the minimum file and inputting it in my script handling the calculations is the last step. My batch files works like a charm when I enter the actual number:
I am restricted to what CMD allows me to do. I cannot use bash or any other unix approach for this particular task
Thanks in advance for any help tackling this issue
It's been a while since I've run batch scripts, but I don't remember it having a command substitution construct like bash (and other POSIX shell conforming utilities) and there's no need to fire up two invocations of awk (or gawk) when awk is perfectly capable of reading two input files in one invocation. If batch processes single quotes and double quotes the same way the POSIX shell command language does, try:
Or, ff your input files are DOS format text files and you want the output to be a DOS format text file, you might need to get rid of <carriage-return> characters from the input lines and add them to the output:
Neither of these have been tested at all, but should come close to what you need.
This User Gave Thanks to Don Cragun For This Post:
Hi everybody,
First, I'm sorry for my bad english!
I have the following situation:
I have a Windows 2012 R2 with Cygwin installed. The Windows Server is used as a backup Server with Dell AppAssure installed. At the moment, AppAssure saves Backup Targets to a repository on his D. The... (9 Replies)
I have some 50+ files in the following format :
abcd_vish_running_ZEBRA_20140818.dat_08-14-2014_23:08:23
abcd_vish_running_ZEB-RA_20140818.dat_08-14-2014_23:08:35
abcd_vish_running_ZEB_RA_20140818.dat_08-14-2014_23:08:37
abcd_vish_running_RI-NG_20140818.dat_08-14-2014_23:08:42... (5 Replies)
As stated, I am looking into keeping my backup drive unmounted in normal windows use. Partly this is to address threats like cryptolocker. Since one of my backup drives is an internal drive, it will not likely afford any protection from such a threat. I am thinking of adding code to my rsync script... (5 Replies)
I'm using Notepad++ to edit my BASH scripts and using CYGWIN to run them from Windows7.
In Notepad++ there is a 'Run' capability. How do I get this to run my scripts directly without having to enter the script name from the Cygwin command line? (3 Replies)
Hi,
I put the necessary tftp commands into a batch file and I can run tftp by
$ tftp < tftpbatchscript
in bash command line and then successfully exit.
Now, I want to put a line which does the same thing above. However, when I put this line into a bash script, the lines below this line... (1 Reply)
I'd like to streamline the code more than a bit to get it to run faster.
There's a thread about this and related issues of mine on the Cygwin mailing-list, but I want to eliminate any chances it might just be inefficient/inelegant/crappy code. A previous run of the same script on both Cygwin and... (6 Replies)
Hello everyone,
I am struggling a bit with a batch script that I need to run in cygwin. I work in winXP and I had to write some awk scripts to do some file manipulation, and now I would like to automate the process by just running a batch file so that my colleagues can use it easily.
Now, the... (2 Replies)
I'm trying to write batch scripts of the kind that start a Cygwin session in rxvt from the desktop, with the added feature that the session starts in a folder other than $HOME. I want to do this for two folders I use often.
According to the manpage, rxvt has a "-cd" command. Therefore, at first... (4 Replies)
Hi, all,
I try to run a quite simple bash script mytest.sh in cygwin, it's content is:
#!/bin/bash
echo "It is my first bash shell"
there are three lines in the script. The second line is blank line.
When I run it use command: bash c:/mytest.sh, ... (6 Replies)
so i have hundreds of files named history.20071112.tar
(history.YYYYMMDD.tar)
and im looking to extract one file out of each archive called status_YYYYMMDDHH:MM.lis
here is what i have so far:
for FILE in `cat dirlist`
do
tar xvf $FILE ./status_*
done
dirlist is a text... (4 Replies)