LinuxCommandLibrary

comma

Command 'comma' not a standard Linux command

TLDR

View documentation for the original command

$ tldr ,
copy

SYNOPSIS

command1 , command2 , command3 ...

DESCRIPTION

The comma (`,`) is a command separator in most Unix-like shells, including Bash. It allows you to execute multiple commands in sequence on a single line. Each command is executed independently, and the exit status of only the last command executed is returned. This is different from `&&` (logical AND) and `||` (logical OR) operators, which are conditional command separators. Using a comma can be useful for grouping related commands together for readability, especially within constructs like loops or functions.

Example:
`cd /tmp , ls -l , pwd`
This will first change the directory to `/tmp`, then list the contents of `/tmp`, and finally print the current working directory. The exit code will only reflect the success or failure of `pwd` command. Note that this is mostly used to group command for readability or in specific programming language contexts rather than standard shell scripting.

CAVEATS

The exit status returned will only be that of the last command executed in the sequence.

GROUPING COMMANDS

Although `;` also separates commands, `,` has a specific, albeit less common, usage when passing multiple expressions or arguments to certain programming languages or within specific tools run in the shell. Shell script usage is mostly limited to specific language or shell command line interpretation.

SEE ALSO

&&(1), ||(1), ;(1)

Copied to clipboard