Command-line interface

### 1.2.2 Command-line interface

In Unix and MacOS you can run giac from a terminal with the command icas (the command giac also works). There are two ways to use the command-line interface.

1. If you just want to evaluate one expression, you can give icas the expression (in quotes) as a command line argument. For example, to factor the polynomial x2−1, you can type

   icas 'factor(x^2-1)'

   in a command prompt. The result will be

   (x-1)*(x+1)

   and you will be returned to the operating system command line.
2. If you want to evaluate several commands, you can enter an interactive giac session by entering the command icas (or giac) by itself at a command prompt. You will then be given a prompt specifically for giac commands, which will look like

   0>>

   You can enter a giac command at this prompt and get the result.

   0>> factor(x^2-1) (x-1)*(x+1) 1>>

   After the result, you will be given another prompt for giac commands. You can exit this interactive session by typing Ctrl+D.

   Alternatively, you can run icas in batch mode; that is, you can have icas run giac commands stored in a file. This can be done in Windows as well as Unix and Mac OS. To do this, simply enter

   icas filename

   in a command prompt, where filename is the name of the file containing the giac commands.