DOS like commands on UNIX machine.

DOS like commands on UNIX machine.

Post by tim wern » Thu, 30 Mar 1995 04:00:00




>Date: Wed, 29 Mar 1995 07:39:05 GMT
>DOS commands
>that I need scripts for: TYPE, XCOPY, COPY, DIR, RENAME, DEL.

Just to get started, most of these can be handled with an alias, that
you can put in the user's $HOME/.cshrc file.  I'm going to let someone
else write the scripts for translating the switches.

For example:

   alias type cat
   alias copy cp
   alias dir 'ls -l'
   alias rename mv
   alias del rm
   alias more less

Also, you seemed to be under the impression that csh scripts are written
in "C".  That's not the case -- they are written in csh script language.
You probably need to get a book that explains the csh.  Also, there is
always the man page for csh.  You can try "man csh | col -b | less",
which should make it easier for you to search through the man page than
just plan "man csh".  Hopefully you have "less".  Otherwise use "more",
or else your favorite pager.

One particularly good book would be "An Introduction To Berkeley Unix",
by Paul Wang.

hope that helps,
tw

--
Do not drink coffee in early A.M.  It will keep you awake until noon.

 
 
 

DOS like commands on UNIX machine.

Post by Packy Forre » Thu, 30 Mar 1995 04:00:00


Just FYI...

Some better specs on what I need.=20

csh scripts with case and if/then/else logic are needed to  be able to
type in a DOS command (with switches) on a UNIX machine and have a UNIX
command / script (with associated switches) give the same info to the
user on the UNIX  machine as they would get on a DOS machine.
         *Their is NO dos machine/files just dos commands*
A simple example would be dir/w or dir /w (for a wide directory listing).
The closest UNIX command that I know of would be simple: ls -m

But you would have to test for dir/w, dir /w, dir/wp, dir /wp, dir/pw,
dir /pw, dir/p, and dir /p and all for upper/lower case to boot.

Of course the /p is to pause the listing. I guess in UNIX you could do
a ls -m|pg if a /p was used.
=20
Here are the DOS commands with examples and switches of what a UNIX
command would have to duplicate.

*********************************************************************
*********************************************************************

                              The DIR Command                              =
  =20
=20
Purpose:  Displays information about files in a disk directory.

Use to:     Check the spelling of a file's name
            Make sure that a particular file exists
            Find the size of a file
            Check the date and time the file was created (or modified)

Usage:    DIR [d:][filespec] [/P] [/W]

          /P causes the display to pause when the screen is filled.  With
             DOS 4.0 this will recognize 43- and 5-line screens.  See MODE=
=20
          /W causes filenames to be displayed in a Wide (5-across) format.

Remarks:  You may use wildcard characters to select a subset of files.

          When no filespec is given, or when just a pathname is given, DIR
          assumes a filename and extension of *.* (ie, all files).

          When only the filename is used (ie, DIR myfile) the extension is
          assumed to be .* (any extension).

          Here's an example screen:
------------------------------------------------------------------------
  C>DIR                                    =20
   Volume in drive C is HARD DISK       <--- volume label (if any)=20
   Volume Serial Number is 3C61-1CF2    <--- DOS 4.0 only (ignore it)=20
   Directory of  C:\                    <--- full name of this directory=20
                                                                        =20
  COMMAND  COM   45696  2-16-85  12:01a <--- name,extension,size,date,time=
=20
  AUTOEXEC BAT     213  6-09-86  12:35p                                   =
=20
  UTILS          <DIR>  4-07-86   8:01p                                   =
=20
         3 File(s)  9152224 bytes free                                    =
=20
  C>_                                                                     =
=20
 ----------------------------------------------------------------------

Examples: DIR
            With no parameters, DIR assumes all the defaults.  It lists all
            files in the default directory of the default drive=20

          DIR A:
            lists all files in the default directory of drive A

          DIR c:\dbase /p
            lists all files in the \DBASE directory of drive C.  The /P mak=
es
            the listing pause after each screenful is scrolled.

          DIR c:\dbase\*.dbf
            lists all files in the \DBASE directory of drive C that have an
            extension of .DBF

Hint:    DIR does not list hidden files.  See CHKDSK /V for a way to do so.

         Use the SORT filter to put the listing in alphabetical order.

See Also: File Naming Rules   File Commands   Paths and Directories=20
=20
=20
*********************************************************************
=20
                              The COPY Command                             =
  =20
=20
Purpose:  Copies a file or group of files from one place to another.
          This is the common syntax.  See COPY continued... for other optio=
ns.

Use to:     Duplicate a file or set of files for backup purposes
            Send text data to the printer
            Create a standard ASCII text file directly from the keyboard

Usage:    COPY [d:]filespec [[d:]filespec] /V
                    |             |        =20
                  source        target

Remarks:  /V means to verify the copy (see VERIFY ON ).

          Any of the reserved filename devices can be a source or target.

          If the 'target' filespec exists, it will be overwritten with a
          duplicate of the 'source' filespec.

          Since COPY is used often, it provides many shortcuts, so you can
          save some typing.  If you are just getting started, it is best to
          use full filenames for both the 'source' and the 'target'.  Power
          users can take advantages of these short cuts:

          =FE Use wildcard filespecs to copy groups of files from one direc=
tory
            or drive to another.  A wildcard in the 'source' means "copy al=
l
            matching files."  A wildcard in the 'target' means use the same
            name as the 'source'.

          =FE When 'target' consists of only a drive ID, the source file(s)=
 are
            copied to that drive with the same names (as if 'target' includ=
ed
            a *.* wildcard)

          =FE When 'target' is omitted entirely, the current default drive =
and
            default directory on that drive are assumed and the 'source' mu=
st
            contain a valid drive ID of pathname.

          =FE When the source is a pathname all files in the directory are
            copied (*.* is assumed).  When the target is a pathname, the
            'source' file(s) are copied into that directory.

Examples: COPY myfile.dat myfile.bak
            duplicates MYFILE.DAT, naming the copy as MYFILE.BAK
                                                               =20
          COPY myfile.dat *.bak
             same as above, but saves you some typing

          COPY A:*.bas C:
             copies all files with an extension of .BAS on drive A: to
             files of the same name on drive C:

           COPY a:*.bas
             copies all files with an extension of .BAS on drive A: to
             files of the same name on the  default drive=20

          COPY c:\utils a:
=20
=20
                              The COPY Command                     ...conti=
nued
=20
            copies all files in directory C:\UTILS to the same names on
            drive A.  Use this to backup files to floppy diskettes.

          COPY a:myfile.dbf c:\dbase
            copies MYFILE.DBF from drive A to C:\DBASE\MYFILE.DBF

Hints:    To print a text file, copy it to the printer:

              COPY c:\pascal\myprog.pas PRN  (make a raw printout of the fi=
le)

          To quickly create a text file (for instance, a batch file ), copy
          from the console to a disk file:

              COPY CON c:\autoexec.bat

          Just enter the lines of text, then press [F6] or Ctrl-Z after
          entering the last line. =20

=20
*********************************************************************
=20
                             The RENAME Command                            =
  =20
=20
Purpose:  Changes the filename and/or extension of a file.

Use to:     Give a file a name that's easier to remember
            Give an obsolete version of a file a different name

Usage:    RENAME [d:]filespec filename[.ext]
          or
          REN    [d:]filespec filename[.ext]
                       |             |      =20
                 current name    new name

Remarks:  RENAME may be shortened to REN.

          Limitations:
              The 'new name' must not exist
              You can't rename a directory
              You can't rename a file's drive or path; the new name must
              consist of the filename and extension  only.

          You can use wildcard characters to save some typing.  Any wildcar=
d
          character in the second parameter (the new name) will be replaced
          with characters from the first parameter (the original name).

Examples: RENAME a:myfile.dat myfile.bak
           MYFILE.DAT (on drive A) is given the name MYFILE.BAK

          REN current.dat 1986.*
           CURRENT.DAT (on the default drive) is given the name 1986.DAT

          REN a:*.dat *.bak
           All files on drive A that have an extension of .DAT are given an
           extension of .BAK

Hints:    DOS provides no way to rename a directory; however, you can get
          the same effect by creating a new directory with the desired name=
,
          copying all files from the old directory into the new, and
          deleting the files from, and removing, the old directory:
                                                       =20
=20
*********************************************************************
(This is a tuff one. Would probably require a few diff UNIX commands to
make this DOS command work)

                             The XCOPY Command                             =
  =20
=20
Purpose:  Copies files and groups of files and can include files from child=
=20
          subdirectories.  This is an external command.              DOS 3.=
2+=20

Use to:     Copy groups of files FAR FASTER than the COPY command.
            Backup hard disk files faster than BACKUP  (perfect for hard
            disk-to-hard disk backup)
            Transfer whole directories and entire directory sub-trees from
            one hard disk PC to another (via floppy disks)
            Copy files selectively by date or modification status

Usage:    XCOPY d:filespec [d:][filespec] [/S][/E] [/A or /M][/D] [/P][/W][=
/V]
                      |            |       =20
                   source       target

Remarks:  Files from the 'source' are copied to the 'target'.
          XCOPY assumes the current defaults if any drive or path is omitte=
d.
          It assumes *.* if a filename and extension is omitted, however, a=
t ...

read more »

 
 
 

DOS like commands on UNIX machine.

Post by Packy Forre » Thu, 30 Mar 1995 16:39:05


HELP (please),

I am a new sys admin on a new system here at work.  All my users are DOS
people.  What they are requesting / demanding is a DOS like interface
until they have time to learn some UNIX.  Their are lots of UNIX programs
that make DOS look like / work like UNIX but I need UNIX programs that
look like DOS.  Example a "C" shell script that would work on a UNIX
system when a user typed in a DOS command like XCOPY (DOS command and
switches translated to UNIX commands and switches).  Of course all the
switches need to work.  I need the "C" shell script un-compiled.  I need
to learn how to do this myself.  Looking at the code would help a lot.
So if you could possibly steer me in the right direction where I may beg,
borrow or buy such scripts I would be very grateful.  Their must be
someone somewhere that has already created these scripts.  DOS commands
that I need scripts for: TYPE, XCOPY, COPY, DIR, RENAME, DEL.  Thanks in
advance...

Packy

 
 
 

DOS like commands on UNIX machine.

Post by Christopher B. Brow » Sat, 01 Apr 1995 04:00:00




Much omitted...

Your extensive specifications on some moderately esoteric commands
such as xcopy suggest to me that you're looking for the wrong solution
to the problem.

What would be *nice* would be to have some simple macros or sh scripts
that would emulate the MS-DOS commands.

Unfortunately, you'll find yourself trying to replicate complexity at
two levels:
a) Command parsing (e.g. - "DIR" is the same as "dir", and "dir/w"
does the same thing as "DIR /W", both of which are essentially variants
of "dir."

In order to get this to work the way you expect, you will either have
to create a *large* set of aliases (and "dir/w" is still a bad problem)
or create a command interpreter (e.g. a shell) that emulates
COMMAND.COM.

b) File system emulation (e.g. - handling ATTRIB and the likes).
Without a doubt there are differences in the sorts of things that can
be done with the options.

I think that the only way you're going to get this to work the way
you hope is to rewrite COMMAND.COM in C or Perl.  Aliases and shell
scripts are *not* going to do the trick.  This shell, /bin/msdogsh,
would naturally need to be able to handle the built-in commands.

I don't think there's any way of making any of the common shells
under UNIX behave as if they're COMMAND.COM.  Things like the
presence of regular expression parsing, globbing, aliases and
the standard file addressing mechanisms seem to suggest that any
lesser hack won't work the way you hope.
--

In most of their applications, GUIs are primarily a tool that enables
capitalists to exploit cheap, dispensable, unskilled labour - The GUI
Manifesto

 
 
 

1. DOS like commands on UNIX machine

Hello and HELP!!!!,

I am a new sys admin on a new system here at work.  All my users are DOS
people.  What they are requesting / demanding is a DOS like interface
until they have time to learn some UNIX.  Their are lots of UNIX programs
that make DOS look like / work like UNIX but I need UNIX programs that
look like DOS.  Example a "C" shell script that would work on a UNIX
system when a user typed in a DOS command like XCOPY.  Of course all the
switches need to work (the shell needs to convert DOS commands and
switches to UNIX commands and switches).  I need the "C" shell script
un-compiled.  I need to learn how to do this myself.  Looking at the code
would help a lot.  So if you could possibly steer me in the right
direction where I may beg, borrow or buy such scripts I would be very
grateful.  Their must be someone somewhere that has already created these
scripts.  DOS commands that I need scripts for: TYPE, XCOPY, COPY, DIR,
RENAME, DEL.  Thanks in advance...

Packy Forrey

2. NEED HELP

3. DOS like commands on UNIX machine.

4. 2.1.35 ? PNP OK but AWE32 NOT DETECTED? WHY???

5. crack

6. NIC testing

7. Mount DOS on DOS machine from LINUX on LINUX machine

8. Need to convert DOS to UNIX with a *limited* set of UNIX commands

9. Help-PC likes linux so much won't run DOS

10. Mouse Likes DOS but hates Linux

11. RH 7.1 likes memory on my machine