en fr

Sysquake Pro – Table of Contents

Sysquake – Table of Contents

Sysquake for LaTeX – Table of Contents

Extension - Shell

This section describes functions related to the Unix or Windows shell. They are available only on Windows and on Unix (or Unix-like) systems, such as macOS.

The versions for Unix and Windows have significant differences:

Functions

cd

Set or get the current directory.

Syntax

cd(str)
str = cd

Description

cd(str) changes the current directory. Without input argument, cd gives the current directory, like pwd.

The current directory is the root directory where files specified by relative paths are searched by functions like fopen and dir. LME libraries are specified by name, not by path; the places where they are searched is specified by a list of search paths, typically specified with a path command or a dialog box in a graphical user interface.

Example

cd('/usr/include');

See also

pwd, dir

cputime

Amount of processing time since the beginning of the process.

Syntax

t = cputime

Description

cputime gives the amount of processing time spent since the application has been launched.

See also

posixtime, clock

dir

List of files and directories.

Syntax

dir
dir(path)
r = dir
r = dir(path)

Description

dir displays the list of files and directories in the current path. A string input argument can specify the path.

With an output argument, dir returns the list of files and directories as a structure array with the following fields:

NameValue
namefile name or directory name
isdirfalse for files, true for directories
altnamealternate name (Windows only)

Field isdir may be missing on some patforms. On Windows, altname contains the DOS-compatible name (a.k.a. "8.3") if it exists, or an empty string otherwise.

See also

cd, pwd

dos

Execute a command under Windows.

Syntax

status = dos(str)

Description

dos(str) executes a command with the system Windows function. No input can be provided, and output is discarded. dos returns the status code of the command, which is normally 0 for successful execution.

Example

dos('del C:/tmp/data.txt');

See also

unix

getenv

Get the value of an environment variable.

Syntax

value = getenv(name)

Description

getenv(name) gives the value of the environment variable of the specified name. If no such environment variable exists, getenv returns an empty string.

Example

user = getenv('USER');

See also

setenv, unsetenv

pwd

Get the current directory.

Syntax

str = pwd

Description

pwd ("print working directory") gives the current directory. It has the same effect as cd without input argument.

See also

cd, dir

setenv

Set the value of an environment variable.

Syntax

setenv(name, value)
setenv(name)

Description

setenv(name,value) sets the value of the environment variable of the specified name. Both arguments are strings. If no such environment variable exists, it is created.

With a single input argument, setenv creates an empty environment variable (or remove the value of an exisisting environment variable).

Environment variables are defined in the context of the application; they can be accessed in the application or in processes it launches. Environment variables of the calling process (command shell, for instance) are not changed.

setenv is not defined for Windows.

Example

setenv('CONTROLDEBUG', '1');

See also

getenv, unsetenv

sleep

Suspend execution for a specified amount of time.

Syntax

sleep(t)

Description

sleep(t) suspend execution during t seconds with a resolution of a microsecond.

Example

sleep(1e-3);

unix

Execute a Unix command.

Syntax

unix(str)

Description

unix(str) executes a command with the default shell. No input can be provided, and output is directed to the standard output of LME.

Examples

unix ls
unix('cc -o calc calc.c; ./calc')

See also

dos

unsetenv

Remove an environment variable.

Syntax

unsetenv(name)

Description

unsetenv(name) removes the definition of the environment variable of the specified name. Argument is a string. If no such environment variable exists, unsetenv does nothing.

Environment variables are defined in the context of the application; they can be accessed in the application or in processes it launches. Environment variables of the calling process (command shell, for instance) are not changed.

unsetenv is not defined for Windows.

Example

unsetenv('CONTROLDEBUG');

See also

getenv, setenv