MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Use of Mathematica under UNIx

  • To: mathgroup at smc.vnet.net
  • Subject: [mg30909] Re: [mg30889] Use of Mathematica under UNIx
  • From: "P.J. Hinton" <paulh at wolfram.com>
  • Date: Mon, 24 Sep 2001 01:49:13 -0400 (EDT)
  • Organization: "Wolfram Research, Inc."
  • Sender: owner-wri-mathgroup at wolfram.com

On Sun, 23 Sep 2001 julie.rigaud at edf.fr wrote:

> I'd like to use unix command in a mathematica programm.
> I thaught that it was possible to do it by using "!" (ex : "! mkdir
> file").
> But it doesn't work.
>
> So how can I do ?

The exclamation point syntax you describe is an example of special input,
which means that the input _must_ appear at the beginning of a line for it
to be interpreted as such.  This is probably why you are having troubles.

If you want to execute arbitrary shell commands within some Mathematica
code, you can you Run[].  The function returns the exit code provided by
the operating system.  It does not capture output directed to stdout or
stderr.

If you want to capture output you can use pipe the output to an Import[]
command.

In[1]:= Import["!date", "Text"]

Out[1]= Sun Sep 23 14:33:57 CDT 2001

-- 
P.J. Hinton
User Interface Programmer                         paulh at wolfram.com
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.



  • Prev by Date: Re: ReadList, mix Words & Numbers?
  • Next by Date: Re: ConstarinedMin Question
  • Previous by thread: Use of Mathematica under UNIx
  • Next by thread: Gamma Simplification