Software Archive
Read-only legacy content

Using scripts

Intel_C_Intel
Employee
830 Views
I have an appliction (Fortran) which needs to generate an input file. In VAX and Unix environments the input file is generated using scripts. I wonder whether there is any such thing in pc environment either in window itself or in Visual Fortran(C++) using dialog box, console or any other means. Few lines from the script application is included:

if (-e /tmp/linfile$$) rm -f /tmp/linfile$$ 
touch /tmp/linfile$$ 
if (-e /tmp/loutfile$$) rm -f /tmp/loutfile$$ 
w "Specify identifier for this session (up to 80 characters)" 
set label = $< 
w $label >> /tmp/linfile$$ 
tr '[a-z]' '[A-Z]' < /tmp/linfile$$ > /tmp/loutfile$$ 
set label = `cat /tmp/loutfile$$` 
 
w  enter  '0' to exit .......................... '1' to print volume attenuation 
w  enter  '2' to plot ocean sound speed ........ '3' to plot rays 
w  enter  '4' to print the eigenrays ........... '5' to print prop loss vs range 
w  enter  '6' to plot prop loss vs range ....... '7' to plot pressure vs range 
w  enter  '8' to generate prop loss contours ... '9' to generate pressure contours
0 Kudos
3 Replies
TimP
Honored Contributor III
830 Views
My preference is to build and run under cygwin, which supports bash, sh, tcsh, and pdksh.( http://www.sourceware.cygnus.com ) MKS may be preferred if a fully supported ksh is required. I've gone so far as to run MPI Fortran programs under tcsh on Windows. No, scripts don't run as fast as on linux.
0 Kudos
Intel_C_Intel
Employee
830 Views
Thank you tprince for the reply. As per your suggestion I installed the 'cygwin'. Now when I click on the icon it opens up a dos window with pwd dpaul. I copied my script file 'input.txt' in that directory; but now when I type input.txt it comes with error message- BASH: @input.txt command not found. I used chmod 777 to have execute privilege.Also ./input.txt says bad interpreter. I remember I had similar problem with Linux and I was able to execute a file by ./ and also by adding export PATH=$PATH:. I shall appreciate if could suggest something.
0 Kudos
TimP
Honored Contributor III
830 Views
Bash on cygwin has the same path considerations as on linux. Unless you are on Win2K or XP, there are no file permissions. Cygwin recognizes an executable script and the processor which is to run it by the usual first line notation
!#/bin/sh
or whatever. Only sh, bash, and tcsh are supported (ksh if you install pdksh). cygwin doesn't come with csh aliased to tcsh, as linux does, but you could add that.

Other possibilities, which could amount to overkill, include one of the perl implementations, including the one in cygwin, or active-state perl.

Sorry, I just realized my answer of several days ago didn't make it to the forum.
0 Kudos
Reply