cmdsep

Returns the string that separates commands on one line of the system shell.

Category: Environment and Settings > System Commands

Syntax

sep = cmdsep

Returns the command separator of the current platform.

Description

Shells differ in how they chain several commands in one string. cmdsep returns the separator for the host so that a string passed to system can run two commands in order without hard-coding the platform.

Output arguments

sep
Character vector with the separator.

Example

Chain two commands

sep = cmdsep;
cmd = ['echo first ' sep ' echo second'];
[status, out] = system(cmd);
disp(out)
Output
first 
second

See also

system dos unix perl