Ask Your Question
0

How can I open a program written in sage, in the Terminal of sage?

asked 2013-02-13 00:02:52 +0200

m marta gravatar image

updated 2013-02-13 10:25:42 +0200

kcrisman gravatar image

I have a file which is written in sage language and I want to open it in Terminal of sage,could you please inform me how can I open it,and how can I run it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2013-02-13 00:36:43 +0200

ppurka gravatar image

updated 2013-02-13 00:38:26 +0200

What do you mean my "Terminal"?

  1. If you are referring to a terminal like OSX Terminal, or some GUI terminal (xterm, konsole, gnome-terminal, etc) in Linux, then you can simply use whatever editor (say, kate, kwrite, gedit, etc) you have present to edit the sage file. If you want to launch the editor from within sage then you need to give an exclamation mark before launching it. Like

    sage: !gedit /path/to/file.sage
    

    If you want to only view the file and not edit it, then you can run something like

    sage: !less /path/to/file.sage`
    

    and when you are done viewing press q to exit.

  2. If you are on a console in Linux, then you can use less to view the file as shown above or nano to edit the file: !nano /path/to/file.sage. In nano, the options that are possible are listed at the bottom of the screen.

You can run the file in three ways. First way is to run the following command in the command prompt (not the sage: prompt):

/path/to/sage /path/to/file.sage

The next two ways can be used from within Sage, when you are in the sage: prompt.

  1. use attach which continuously monitors the file for changes.

    sage: attach "/path/to/file.sage"
    
  2. use load which runs the file only once and doesn't monitor it for changes.

    sage: load("/path/to/file.sage")
    

Look at the help by running attach? and load? to learn about their syntax and other examples.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-02-13 00:02:52 +0200

Seen: 3,094 times

Last updated: Feb 13 '13