### 2.2.2 The 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.

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)’

at a command prompt. The result will be

(x-1)*(x+1)

and you will be returned to the operating system command line.

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.

You can also 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

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