Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2023.0.0 - Português


scilab

runs Scilab in interactive or batch mode with command line options

Syntax

scilab <Options>

Options

The list of Scilab launching options -- including options for developers -- can be displayed in the OS terminal through the --help option.

unix_w(SCI+"/bin/scilab --help 2>&1")
--> unix_w(SCI+"/bin/scilab --help 2>&1")
Usage: Scilab <options>
      -args arg1 arg2..: Send directly some arg1 arg2 .. data to the session.
                         arg1 arg2 .. values can then be read through sciargs().
      -e Instruction   : Execute the scilab instruction given in Instruction argument.
                         -e and -f arguments are mutually exclusive.
      -f File          : Execute the scilab script given in File argument.
                         -e and -f arguments are mutually exclusive.
      -quit            : force scilab exit after execution of script from -e or -f argument.
                         Flag ignored if it is not used with -e or -f argument.
      -l lang          : Change the language of scilab (default : en_US).
      -nw              : Enable console mode.
      -nwni            : Enable terminal mode.
      -ns              : Do not execute etc/scilab.start.
      -nouserstartup   : Do not execute user startup files (SCIHOME/scilab.ini|.scilab).
      -noatomsautoload : Do not autoload eligible ATOMS modules.
      -nb              : Do not display the banner (no banner).
      -scihome <dir>   : Force SCIHOME to <dir>.
      -texmacs         : Option to use Scilab from documents through http://texmacs.org.
      -version         : Display the Scilab version (no session opened).
      -display Display : Set the display to the X server Display (XWindow systems only).
                         unix:0.0 is the default.
      --help           : Display this help.

Developer Trace arguments:
      --parse-trace    : Display bison state machine evolution.
      --AST-trace      : Display ASCII-art AST to be human readable.
      --pretty-print   : Display pretty-printed code, standard Scilab syntax.

Developer Timer arguments:
      --AST-timed      : Time each AST node.
      --timed          : Time global execution.

Developer Debug arguments:
      --no-exec        : Only do Lexing/parsing do not execute instructions.
      --context-dump   : Display context status.
      --exec-verbose   : Display command before running it.
      --timeout delay  : Kill the Scilab process after a delay.

They are described below.

-args arg#1 arg#2 ..

This option allows to send some data to the Scilab session:

  • Consecutive data are separated by one or several spaces.
  • An expression between double-quotes is a single data.
  • To include a double-quote in a data, write \" instead of ".
  • The single quote ' is a regular character. It has no special meaning.

Inside the opened session, these data can be retrieved as separated strings with sciargs().

Example:

C:\Users\Me> C:\SCIdir\bin\scilab -nw -nb -noatomsautoload -args "Hello %USERNAME%" 1.2345 \"%cd%\"
// Inside the opened session:
a = sciargs()
i = find(a=="-args")
a(i+1)
evstr(a(i+2))*2
"This session has been launched from " + a(i+3)
--> // Inside the opened session:
--> a = sciargs()
 a  =
! c:\SCIdir\bin\WScilex-cli.exe !
! -nb                           !
! -noatomsautoload              !
! -args                         !
! Hello John                    !
! 1.2345                        !
! "C:\Users\Me"                 !

--> i = find(a=="-args")
 i  =
    5.

--> a(i+1)
 ans  =
 Hello John

--> evstr(a(i+2))*2
 ans  =
    2.469

--> "This session has been launched from " + a(i+3)
 ans  =
 This session has been launched from "C:\Users\Me"

Note here that >scilab -nw has been translated into Wscilex-cli.exe by the scilab batch file, in such a way that the "-nw" option is not returned by sciargs() (see further below).

Using -args as the last command line option is safer.

-display Display

For use under Xwindow systems only to set a specific X server display. Default display is unix:0.0.

-display can be abbreviated by -d.

-e Instructions

At the end of the whole session startup, this option

  • sets the current working directory to the shell directory from which Scilab has been launched. Please see the example given here-below for the -f option. Then,

  • executes Scilab Instructions provided in a string. Example:

    OS> scilab -nw -e  "disp(\"Hello\"); a=%pi+%i; disp(exp(a)); exit;" -nb

-e and -f options can't be used together.
-f file

If this option is used, then at the beginning of the Scilab session, after the execution of the scilab and user startup files, and after the setting of user Preferences -- including the working directory ones --,

  • the current Scilab working directory is set to the shell directory from which Scilab has been launched. For instance,

     D:\users\me\scilab\dev> C:\SCIdir\bin\scilab -f ..\test.sce
    will do a cd("D:\users\me\scilab\dev").

  • the Scilab script file is executed. If a relative path is used (default .\, or like ..\ in the sample here-above), it refers to the new Scilab working directory.

A file with .xcos extension will be opened by Xcos.

-quit

This option forces scilab to always exit after the instruction(s) passed with the -e option, or the script referred to by the -f option, have been executed, even in case of a runtime error. This option should always be used in batch mode. It is ignored if neither -e nor -f options are present.

-l lang

If this option is present, it sets the user language. lang can be: ca_ES de_DE en_US es_ES fr_FR ja_JP pt_BR ru_RU zh_CN zh_TW.

For compatibility reasons, other possible lang values are 'fr' for french, 'en' for English, or 'pt' for Brasilian Portuguese. The default language is English.

On Windows, in "-nw" or "-nwni" modes, the selected font of the terminal must be a TrueType one to support UTF-8 characters, like Monospaced (best choice if available) or Consolas or Lucida Console..

On some systems, locales must be compiled to render correctly UTF-8 fonts.

-nb

"no banner": Cancels the display of the Scilab's loading message.

-ns

"No Startup files": Cancels the execution of the main startup file SCI/etc/scilab.start and of the user startup files SCIHOME/.scilab, SCIHOME/scilab.ini.

This option will disable many features in Scilab. Please use it only if you know what you are doing.

-nouserstartup

Cancels the execution of the user startup files SCIHOME/.scilab and SCIHOME/scilab.ini.

-noatomsautoload

Cancels the autoloading of installed ATOMS modules at startup.

-nw

If this option is present, Scilab is started as command line with advanced features still available (graphics, export, xcos, scinotes, help browser, ...).

pipes are enabled for all operating systems. See the examples for further details.

The actual Scilab binary file executed when using the "-nw" option is

  • on Windows: WScilex-cli.exe.
  • on Linux and MacOS: scilab-adv-cli (Scilab Advanced Command Line Interpreter).

-nwni / -nogui
This mode prevents loading the Java Virtual Machine. It starts faster and uses less memory. But then...
Scilab is started as command line interpreter without any advanced features requiring the JVM: graphics, export, xcos, scinotes, help browser, other java interfaces, the Java module,... are not available.

Anyway, pipes are enabled for all operating systems. See the examples for further details.

Dedicated executable files performing the -nwni mode are provided:

  • Windows: Scilex.exe.
  • Others: scilab-cli (Scilab Command Line Interpreter).

-scihome dir

Forces SCIHOME to the dir directory. If the path includes some white space, it must be specified between double-quotes (no single quotes!). if dir is a relative path, dir is added to the parent standard SCIHOME folder.

On Windows: %USERPROFILE%\AppData\Roaming\Scilab\dir
On Linux/MacOS: ~/.Scilab/dir

--texmacs

This option is used when Scilab is used as computational interface within the TeXmacs scientific editor, using the TeXmacs ATOMS module. This one can be priorly installed in Scilab with atomsInstall('texmacs').

-version

Only displays the Scilab's version in the OS terminal, without launching any Scilab session.

Additional options for Unix/Linux and Mac OS X

Advice: use theses options on a Scilab source tree.

-debug

Start Scilab under the debugger gdb.

The variable SCILAB_GDB_OPT may be set to add custom options to gdb.

-debug-rr

Start Scilab under rr.

-debug-kdbg

Start Scilab under kdbg.

-profiling

Start Scilab under valgrind.

The variable SCILAB_VALGRIND_OPT may be set to add custom options to valgrind (and override the existing valgrind options).

-profiling-visu

Start Scilab under callgrind.

The variable SCILAB_VALGRIND_OPT may be set to add custom options to callgrind (and override the existing callgrind options).

-electric-fence

Start Scilab with the Electric Fence.

Environment variables

SCIVERBOSE

If this variable is present, Scilab startup script will show a startup debug information. Mainly used for bug report and debugging purposes.

JAVA_HOME

Specify which Java to use. For example, JAVA_HOME=/usr/lib/jvm/java-7-openjdk/ scilab will start Scilab with Java 7.

SCI_DISABLE_TK

Disable Tk (but not Tcl) features.

SCI_JAVA_ENABLE_HEADLESS

Enable Java Headless VM (i.e. without GUI features).

Java Virtual Machine options

The options described here-below are useless and are cancelled if the option -nwni is used.

Starting from Scilab 5.0, the graphical user interface (GUI) and the build documentation are based on Java features. In some cases, it can be important to edit the JVM options (Java Virtual Machine).

These options are available in the SCI/etc/jvm_options.xml file. The three following options are easily accessible in this file:

-XmxXXXm

This option set the amount of memory available by the Java Virtual Machine. By default, 256M are allocated. If you change this value, check that the value does not exceed the memory available on the system.

This value can be changed in the preferences menu.

-Djava.compiler=JIT

This option with the argument JIT enables the Java Just In Time compiler. It is activated by default. NONE disables the JIT and decreases dramatically performances.

-verbose:jni / -Xcheck:jni

These options enable more checks and output from the JNI calls. These options are useful in case of debugging and are disabled by default since they decreases performances.

Many more options are available. They can improve the performances, change look and feel, change memory managements... See: http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html.

Examples

# Let's start Scilab in profiling mode without attaching a gdb once a SIGSEGV is met.
# We are under Bash shell
export SCILAB_VALGRIND_OPT="--db-attach=no --log-file=myfile.txt"
scilab -profiling

# Let's start Scilab in debug mode without stopping after each SIGSEGV
# First, we write a small command file
echo "handle SIGSEGV nostop" > debug.txt
# Now set the custom option
# We are under Bash shell
export SCILAB_GDB_OPT="--command=debug.txt"
# Start Scilab in debug mode
scilab -debug 

# Under GNU/Linux, Mac OS X or Unix:
$ echo "disp(%pi)" | scilab-cli
or
$ echo "disp(%pi)" | scilab -nwni

# Only open the Scilab help window:
$ scilab-adv-cli -e "help()"
or
$ scilab -nw -e "help()"


# Scilab can be used for scripting aspects:
echo "if 1<>2 then exit(99) end"|scilab-cli
echo $? 

See also

  • startup — arquivo de inicialização
  • sciargs — scilab command line arguments
  • getpid — Retorna o identificador do processo Scilab
  • getenv — retorna o valor de uma variável de ambiente
  • getversion — retorna o nome da versão do Scilab
  • getscilabmode — retorna o modo do Scilab
  • consolebox — shows or hides the MS Windows terminal running the Scilab session
  • exit — Ends the current Scilab session
  • preferences — Open the Scilab Preferences window
  • TeXmacs

History

VersionDescription
5.2.0 Piping is enabled. Option -l lang added
5.4.0 -noatomsautoload added. The Java Heap memory can be set through the preferences.
5.4.1 scinotes and xcos individual scripts introduced. See SEP #87.
6.0.0
  • User options:
    • Added: --help, -quit
    • Removed: -mem
  • Developer options added:
    • --parse-trace, --AST-trace, --pretty-print
    • --AST-timed, --timed
    • --no-exec, --exec-verbose, --timeout delay, --context-dump.
6.0.1

-scihome option added.

On Windows, a new scilab.bat file becomes the main executable script managing all launching options. There are now 3 binaries Wscilex.exe, Wscilex-cli.exe, and Scilex.exe corresponding to each Scilab running mode (STD, NW, NWNI).

Report an issue
<< quit Scilab startup >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Mar 27 09:49:51 GMT 2023