Windows command shell equivalent in Unix

In Windows we use cmd.exe \c as the command SHell

What is its equivalent in UNIX ?

Thanx for all your help.

/bin/sh

anthing you pass to //bin/sh will get run as shell script.

That was a quick response. Thanx.

Just curious why would

/bin/sh ls command fail with Execute permission denied

but $ls works

all unix shell scripts start with #!/bin/sh
the #! is a statment to the kernal to run the following stuff with /bin/sh
if you where doing perl script the your first line would be #!/usr/bin/perl

what are you trying to get done?

if you are trying to do someting like a .BAT file then you will make a file starting with #!/bin/sh

I have a Java application which goes to the OS and runs unix utlities.
So its not running any shell scripts.
I needs to know the shell command line which I give it as /bin/sh as you mentioned

It will then go to the shell and run say commands like ls

/bin/sh ls which it fails with execute permission denied

now I understqand what your doing....
you should just be able to use "ls" or what ever directly.

you should not need /bin/sh for this kind of thing....

what command do you want to run??

The problem is the Java application runs the shell and then the ls command

So in the application it ask for the shell interpretor which I give /bin/sh

then it uses this to run the ls command or basic utilities.

Q:- why would $/bin/sh ls not work when
$ls works ?

Try

/usr/bin/ls from the command prompt.

cheers,
Devaraj Takhellambam

if you run /bin/sh you will get a shell.
much like clicking start,run, cmd.exe

if you want to run the command ls, you should just be able to run ls from within java's system call type code thing. (I dont write java so not sure of correct wording)

if you want to pass the ls command the /bin/sh then you would need something like:

echo "ls" | /bin/sh

this will work but is very odd way of getting things done.

can you post a few lines of java example you what your doing??

Thanx all.

Unfortunately this is 3rd party vendor program written in . I just have the war file.

Do you know teh reason why it does not work. Is that the expected behaviour ?

Try using

/bin/sh -c '<command here>'

, that should work for most cases. But usually on UNIX you shouldn't have to open a command terminal and then execute your command, since most are stand-alone programs.