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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Unix commands in Command prompt?

Reply to Message Icon

Name: cool_andy
Date: April 27, 2007 at 01:45:33 Pacific
OS: Windows XP
CPU/Ram: 512
Product: 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



Sponsored Link
Ads by Google

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

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


0

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

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


0

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

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.


0

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

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.



0

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

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


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Unix commands in Command prompt?

HOW CAN I RUN UNIX COMMANDS in VB6? www.computing.net/answers/programming/how-can-i-run-unix-commands-in-vb6/14264.html

How to automated Command Prompt usi www.computing.net/answers/programming/how-to-automated-command-prompt-usi/4664.html

Send Files in Command Prompt www.computing.net/answers/programming/send-files-in-command-prompt/6603.html