nodejsscript • Docs
nodejsscript / s / ShellReturnValue
cat:
CatFunction
Returns a string containing the given pipeline, or a concatenated string containing the pipelines if more than one input stream is given (a new line character is introduced between each input).
A string containing the given pipeline, or a concatenated string containing the pipelines if more than one input stream is given (a new line character is introduced between each input).
exec:
ExecFunction
Executes the given command.
The command to execute.
Silence and synchronous options.
Receives code and output asynchronously.
Returns an object containing the return code and output as string,
or if {async: true}
or a callback
was passed, a ChildProcess
.
head:
HeadFunction
Read the start of a pipeline input.
grep:
GrepFunction
Reads input string from given files and returns a string containing all lines
of the file that match the given regex_filter
. Wildcard *
accepted.
Available options:
- -v
: Inverse the sense of the regex and print
the lines not matching the criteria.
- -l
: Print only filenames of matching files
The regular expression to use.
Returns a string containing all lines of the file that match the given regex_filter
.
sed:
SedFunction
Reads an input string from pipeline and performs a JavaScript replace()
on the input using the given search regex and replacement string or function.
Available options:
- -i
: Replace contents of 'file' in-place. Note that no backups will be created!
The regular expression to use for search.
The replacement.
The new string after replacement.
sort:
SortFunction
Return the contents of the pipeline, sorted line-by-line.
Available options:
- -r
: Reverse the results
- -n
: Compare according to numerical value
tail:
TailFunction
Read the end of a pipeline input.
uniq:
UniqFunction
Filter adjacent matching lines from input.
Available options:
- -i
: Ignore case while comparing
- -c
: Prefix lines by the number of occurrences
- -d
: Only print duplicate lines, one for each group of identical lines
code:
number
The process exit code.
stdout:
string
The process standard output.
stderr:
string
The process standard error output.
to(
file
):void
Analogous to the redirection operator >
in Unix, but works with JavaScript strings
(such as those returned by cat
, grep
, etc).
Like Unix redirections, to()
will overwrite any existing file!
• file: string
The file to use.
void
toEnd(
file
):void
Analogous to the redirect-and-append operator >>
in Unix, but works with JavaScript strings
(such as those returned by cat
, grep
, etc).
• file: string
The file to append to.
void