run and make an executable file

as i said before i'm a beginner in shell programming and i have two questions:

how to run an executable file in shell scripts like for example let's say the file called "prog.exe", what's the shell command to run this file?

also how can i make the shell file an executable file (if it is "file.sh" i want it to be "file.exe")?

If prog.exe is in a directory in your $PATH:

prog.exe

If not:

/path/to/prog.exe

Why would you want it to be file.exe? Just make file.sh executable:

chmod +x file.sh

The command to run the program is:

./prog.exe

if your current working directory is where the file lives. You can leave out the ./ if the executable is in your path. You can see your path by typing "echo $PATH" at the command line, and you can add directories to your path in your environment with the export command if you have a place you like to keep your scripts.

Also, you're thinking in "Windows," where file extensions tell the operating system what kind of file it is. Things don't work that way in Unix. The operating system knows whether a file is executable by looking at the executable flag. You could name it "cheese.etaothuaos" and it could still be an executable.

As a side note, you may have noticed the "shebang line" in other people's scripts. If you have a bash script, the first line of the file should be:

#!/usr/bin/env bash

If you have a Perl script, it should be:

#!/usr/bin/env perl

And so on. So when you run the program by typing ./file_name, the OS knows whether it should be running bash, korn shell, Perl, Python, or whatever. Of course, this changes once you're actually compiling your code into a binary file, like with C.

well i want to be file.exe because i have linux and windows OS and i need the program to be executed in both also i want it to work forever and using SFU in windows is not that good

also i forget to mention in my question the path to the prog.exe is:

id address/path/to/prog.exe

i mean the program is not on the same computer it's on another computer connected via lan network and nfs

as far as i know, unfortunately you cannot make one program to run equally in both. you will have to write separate programs for each OS. one for linux/unix, one for windows and your windows program will usually have to be created/compiled in the windows environment.

now if it is doing something like accessing a database, you can have one database sitting on say the unix box and have a program on each machine that can both access that one database. but again the program to do so would be separate for each OS.

That will not work. What kind of file is it? If it's a Perl or Python script, it's possible (depending on how it's written and what it does) to run it without changes on Unix and Windows, but you'd need to use the .pl or .py extension. If it's a compiled program written in, for example, C++, you'd need to compile it separately for Unix and Windows.

In any case, calling something a .exe is meaningless -- it doesn't actually do anything. If it's actually a .exe file compiled for Windows, then it lets Windows know that it's an executable file, but the actual format of the file has to also match what Windows expects a .exe to look like.