Computing.Net > Forums > Programming > Unix commands in Command prompt?

Unix commands in Command prompt?

Reply to Message Icon

Original Message
Name: cool_andy
Date: April 27, 2007 at 01:45:33 Pacific
Subject: Unix commands in Command prompt?
OS: Windows XP
CPU/Ram: 512
Model/Manufacturer: Acer
Comment:

Hi,
Is there any way of executing Unix commands in "cmd"?

I would have liked to have used the "find" or "findstr" command but it does not exist on my system. Also what is the DOS alternative for "awk"?

Basically this unix command obtains all the version numbers and writes them to a new textfile:
cat properties.txt | grep Version | awk {'print $2'} > number.txt

I would also to compile programs by running make files
unix = make -f pclib.mak

Andrew


Report Offensive Message For Removal


Response Number 1
Name: StuartS
Date: April 27, 2007 at 02:21:29 Pacific
Reply: (edit)

You wont find Unix command in DOS because Unix is one operating system and DOS is another, each where their own different way of doing things. Also bear in mind, there is NO DOS in Windows XP. What you get with Cmd is a Command Line Interpreter that has a DOS emulator built in.

What you are asking here is one operating system, Windows, that is already emulating another Operating System, DOS, to emulate a third Operating System, Unix.

There is no direct DOS alternative for awk. The nearest you will get is batch files.

I have seen awk type utilities distributed with C programming packages. If you can get your hands one one of them you should find something like what you are looking for, otherwise, write your own.

Stuart


Report Offensive Follow Up For Removal

Response Number 2
Name: cool_andy
Date: April 27, 2007 at 05:15:54 Pacific
Reply: (edit)

Ok I see the problem.
Is it possible to convert shell scripts to DOS format that could run in this command prompt?

Or alternatively maybe I could use Unix which is emulated on my workstation in a program called TeraTerm, to create my whole program.

Basically this is what my program is hopefully going to do (6 steps):
1) Obtain files and version number.
2) Execute source safe "pin" command to pin all files to the latest version.
3) Source safe Checkout all files
4) Run a C program to make changes to the header of the files (comments).
5) Compile all the programs by running make files
6) Source safe checkin files

The problems I am having are:
A) I need a DOS command line to execute Visual source safe commands. I do not think this can be done under Unix or can it?
(commands like "ss pin file.h")

B) I need Unix to run the make files and compile the program.

At the moment I can successfully complete steps 1-4 and 6 in command prompt using a Batch file. But I woud like step 5 to work in sequence which is compiling the program.

Please could you advise me or point me in the right direction

Regards
Andrew Ashcroft


Report Offensive Follow Up For Removal

Response Number 3
Name: ghostdog
Date: April 27, 2007 at 06:08:17 Pacific
Reply: (edit)

some useful unix tools like awk/sed/cat etc have been ported to Windows.eg
1) http://unxutils.sourceforge.net/.
2) http://www.cygwin.com/
etc
so then you could use unix in windows. cygwin has its own "bash shell" so after you install, you can invoke this bash shell (not cmd) and do you unix stuff there. however, judging from your post, i think you can give cygwin a try.


Report Offensive Follow Up For Removal

Response Number 4
Name: nails
Date: April 27, 2007 at 06:10:42 Pacific
Reply: (edit)

Have you considered obtaining external programs that emulate Unix commands? If you we're using a recent version of Window's I'm recommend cygwin, http://www.cygwin.com or the MKS toolkit at http://www.mks.com.

I googled "Unix commands for DOS" and got this hit:

http://www.openetwork.com/berk.html

but I have no experience with it.



Report Offensive Follow Up For Removal

Response Number 5
Name: tonysathre
Date: April 29, 2007 at 16:00:34 Pacific
Reply: (edit)

Like the others said, the Cygwin environment emulates a Bash shell in Windows. You can do everything with it that you would do in Unix/Linux. Even things such as Cron jobs and daemons like Sendmail and OpenSSH.

"Computer security." — Oxymoron


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Unix commands in Command prompt?

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge