Message Boards Message Boards

1
|
2146 Views
|
2 Replies
|
6 Total Likes
View groups...
Share
Share this post:

Is there still a "!!" function? Is it important to the learning curve?

Posted 11 years ago
While working through Programming Paradigms via Mathematica (A First Course) I came across this in lesson 25.
Without formally opening a file, there is a quick way to ask Mathematica what the entire contents of the file are: " !!".
Execute " !!file", where "file" is the file name (without quotation marks!), and Mathematica will simply dump the contents of the file onto the screen.

However the example that they gave failed to display any data as shown by the input and output below:
In[3]:= !!FILE1
Out[3]:= FILE1
Although the rest of the section seemed to work as described:
First, let's read in a single Number, which we expect to be "1".
In[11]:=num = Read[fileref,Number]
Out[11]= 1
And so on.

I have queried the documentation center about “!!” and looked through information on File Operations, and have found no mention of this syntax.
I am wondering if this was a feature of the first version that has either been discontinued or changed, and also if the need to view contents of a file “dumped” on the screen is important in learning about files as representations of data. 
POSTED BY: Clif McInnis
2 Replies
This is no longer available in the frontend user interface.

It is still available when you launch the Mathematica kernel from a command line (terminal) session.

$ math
Mathematica 9.0 for Linux (32-bit)
Copyright 1988-2013 Wolfram Research, Inc.

In[1]:= !!test.m
(* This is a sample file *)

In[2]:=

Note that you can use the function FilePrint to print out the content of a file as well:

FilePrint["test.m"]
POSTED BY: Arnoud Buzing
Posted 11 years ago
Thank You Arnoud,

I used FilePrint["File1"] in place of !!FILE1 and it worked just as the text described. +1
POSTED BY: Clif McInnis
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract