diff --git a/base/process.jl b/base/process.jl index 68228df104c0b..e097118dde2ce 100644 --- a/base/process.jl +++ b/base/process.jl @@ -824,6 +824,22 @@ function cmd_gen(parsed) return Cmd(args) end +""" + @cmd str + +Similar to `cmd`, generate a `Cmd` from the `str` string which represents the shell command(s) to be executed. +The [`Cmd`](@ref) object can be run as a process and can outlive the spawning julia process (see `Cmd` for more). + +# Examples +```jldoctest +julia> cm = @cmd " echo 1 " +`echo 1` + +julia> run(cm) +1 +Process(`echo 1`, ProcessExited(0)) +``` +""" macro cmd(str) return :(cmd_gen($(esc(shell_parse(str, special=shell_special)[1])))) end