Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

shelljs

shelljs24mBSD-3-Clause0.8.5TypeScript support: definitely-typed

Portable Unix shell commands for Node.js

shelljs, bash, unix, shell, makefile, make, jake, synchronous

readme

ShellJS - Unix shell commands for Node.js

Travis AppVeyor Codecov npm version npm downloads

ShellJS is a portable (Windows/Linux/OS X) implementation of Unix shell commands on top of the Node.js API. You can use it to eliminate your shell script's dependency on Unix while still keeping its familiar and powerful commands. You can also install it globally so you can run it from outside Node projects - say goodbye to those gnarly Bash scripts!

ShellJS is proudly tested on every node release since v4!

The project is unit-tested and battle-tested in projects like:

  • Firebug - Firefox's infamous debugger
  • JSHint & ESLint - popular JavaScript linters
  • Zepto - jQuery-compatible JavaScript library for modern browsers
  • Yeoman - Web application stack and development tool
  • Deployd.com - Open source PaaS for quick API backend generation
  • And many more.

If you have feedback, suggestions, or need help, feel free to post in our issue tracker.

Think ShellJS is cool? Check out some related projects in our Wiki page!

Upgrading from an older version? Check out our breaking changes page to see what changes to watch out for while upgrading.

Command line use

If you just want cross platform UNIX commands, checkout our new project shelljs/shx, a utility to expose shelljs to the command line.

For example:

$ shx mkdir -p foo
$ shx touch foo/bar.txt
$ shx rm -rf foo

Plugin API

ShellJS now supports third-party plugins! You can learn more about using plugins and writing your own ShellJS commands in the wiki.

A quick note about the docs

For documentation on all the latest features, check out our README. To read docs that are consistent with the latest release, check out the npm page or shelljs.org.

Installing

Via npm:

$ npm install [-g] shelljs

Examples

var shell = require('shelljs');

if (!shell.which('git')) {
  shell.echo('Sorry, this script requires git');
  shell.exit(1);
}

// Copy files to release dir
shell.rm('-rf', 'out/Release');
shell.cp('-R', 'stuff/', 'out/Release');

// Replace macros in each .js file
shell.cd('lib');
shell.ls('*.js').forEach(function (file) {
  shell.sed('-i', 'BUILD_VERSION', 'v0.1.2', file);
  shell.sed('-i', /^.*REMOVE_THIS_LINE.*$/, '', file);
  shell.sed('-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, shell.cat('macro.js'), file);
});
shell.cd('..');

// Run external tool synchronously
if (shell.exec('git commit -am "Auto-commit"').code !== 0) {
  shell.echo('Error: Git commit failed');
  shell.exit(1);
}

Exclude options

If you need to pass a parameter that looks like an option, you can do so like:

shell.grep('--', '-v', 'path/to/file'); // Search for "-v", no grep options

shell.cp('-R', '-dir', 'outdir'); // If already using an option, you're done

Global vs. Local

We no longer recommend using a global-import for ShellJS (i.e. require('shelljs/global')). While still supported for convenience, this pollutes the global namespace, and should therefore only be used with caution.

Instead, we recommend a local import (standard for npm packages):

var shell = require('shelljs');
shell.echo('hello world');

Command reference

All commands run synchronously, unless otherwise stated. All commands accept standard bash globbing characters (*, ?, etc.), compatible with the node glob module.

For less-commonly used commands and features, please check out our wiki page.

cat([options,] file [, file ...])

cat([options,] file_array)

Available options:

  • -n: number all output lines

Examples:

var str = cat('file*.txt');
var str = cat('file1', 'file2');
var str = cat(['file1', 'file2']); // same as above

Returns a string containing the given file, or a concatenated string containing the files if more than one file is given (a new line character is introduced between each file).

cd([dir])

Changes to directory dir for the duration of the script. Changes to home directory if no argument is supplied.

chmod([options,] octal_mode || octal_string, file)

chmod([options,] symbolic_mode, file)

Available options:

  • -v: output a diagnostic for every file processed
  • -c: like verbose, but report only when a change is made
  • -R: change files and directories recursively

Examples:

chmod(755, '/Users/brandon');
chmod('755', '/Users/brandon'); // same as above
chmod('u+x', '/Users/brandon');
chmod('-R', 'a-w', '/Users/brandon');

Alters the permissions of a file or directory by either specifying the absolute permissions in octal form or expressing the changes in symbols. This command tries to mimic the POSIX behavior as much as possible. Notable exceptions:

  • In symbolic modes, a-r and -r are identical. No consideration is given to the umask.
  • There is no "quiet" option, since default behavior is to run silent.

cp([options,] source [, source ...], dest)

cp([options,] source_array, dest)

Available options:

  • -f: force (default behavior)
  • -n: no-clobber
  • -u: only copy if source is newer than dest
  • -r, -R: recursive
  • -L: follow symlinks
  • -P: don't follow symlinks

Examples:

cp('file1', 'dir1');
cp('-R', 'path/to/dir/', '~/newCopy/');
cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');
cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above

Copies files.

pushd([options,] [dir | '-N' | '+N'])

Available options:

  • -n: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
  • -q: Supresses output to the console.

Arguments:

  • dir: Sets the current working directory to the top of the stack, then executes the equivalent of cd dir.
  • +N: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
  • -N: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.

Examples:

// process.cwd() === '/usr'
pushd('/etc'); // Returns /etc /usr
pushd('+1');   // Returns /usr /etc

Save the current directory on the top of the directory stack and then cd to dir. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.

popd([options,] ['-N' | '+N'])

Available options:

  • -n: Suppress the normal directory change when removing directories from the stack, so that only the stack is manipulated.
  • -q: Supresses output to the console.

Arguments:

  • +N: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
  • -N: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.

Examples:

echo(process.cwd()); // '/usr'
pushd('/etc');       // '/etc /usr'
echo(process.cwd()); // '/etc'
popd();              // '/usr'
echo(process.cwd()); // '/usr'

When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0, starting at the first directory listed with dirs (i.e., popd is equivalent to popd +0). Returns an array of paths in the stack.

dirs([options | '+N' | '-N'])

Available options:

  • -c: Clears the directory stack by deleting all of the elements.
  • -q: Supresses output to the console.

Arguments:

  • +N: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
  • -N: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.

Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.

See also: pushd, popd

echo([options,] string [, string ...])

Available options:

  • -e: interpret backslash escapes (default)
  • -n: remove trailing newline from output

Examples:

echo('hello world');
var str = echo('hello world');
echo('-n', 'no newline at end');

Prints string to stdout, and returns string with additional utility methods like .to().

exec(command [, options] [, callback])

Available options:

  • async: Asynchronous execution. If a callback is provided, it will be set to true, regardless of the passed value (default: false).
  • silent: Do not echo program output to console (default: false).
  • encoding: Character encoding to use. Affects the values returned to stdout and stderr, and what is written to stdout and stderr when not in silent mode (default: 'utf8').
  • and any option available to Node.js's child_process.exec()

Examples:

var version = exec('node --version', {silent:true}).stdout;

var child = exec('some_long_running_process', {async:true});
child.stdout.on('data', function(data) {
  /* ... do something with data ... */
});

exec('some_long_running_process', function(code, stdout, stderr) {
  console.log('Exit code:', code);
  console.log('Program output:', stdout);
  console.log('Program stderr:', stderr);
});

Executes the given command synchronously, unless otherwise specified. When in synchronous mode, this returns a ShellString (compatible with ShellJS v0.6.x, which returns an object of the form { code:..., stdout:... , stderr:... }). Otherwise, this returns the child process object, and the callback receives the arguments (code, stdout, stderr).

Not seeing the behavior you want? exec() runs everything through sh by default (or cmd.exe on Windows), which differs from bash. If you need bash-specific behavior, try out the {shell: 'path/to/bash'} option.

find(path [, path ...])

find(path_array)

Examples:

find('src', 'lib');
find(['src', 'lib']); // same as above
find('.').filter(function(file) { return file.match(/\.js$/); });

Returns array of all files (however deep) in the given paths.

The main difference from ls('-R', path) is that the resulting file names include the base directories (e.g., lib/resources/file1 instead of just file1).

grep([options,] regex_filter, file [, file ...])

grep([options,] regex_filter, file_array)

Available options:

  • -v: Invert regex_filter (only print non-matching lines).
  • -l: Print only filenames of matching files.
  • -i: Ignore case.

Examples:

grep('-v', 'GLOBAL_VARIABLE', '*.js');
grep('GLOBAL_VARIABLE', '*.js');

Reads input string from given files and returns a string containing all lines of the file that match the given regex_filter.

head([{'-n': <num>},] file [, file ...])

head([{'-n': <num>},] file_array)

Available options:

  • -n <num>: Show the first <num> lines of the files

Examples:

var str = head({'-n': 1}, 'file*.txt');
var str = head('file1', 'file2');
var str = head(['file1', 'file2']); // same as above

Read the start of a file.

ln([options,] source, dest)

Available options:

  • -s: symlink
  • -f: force

Examples:

ln('file', 'newlink');
ln('-sf', 'file', 'existing');

Links source to dest. Use -f to force the link, should dest already exist.

ls([options,] [path, ...])

ls([options,] path_array)

Available options:

  • -R: recursive
  • -A: all files (include files beginning with ., except for . and ..)
  • -L: follow symlinks
  • -d: list directories themselves, not their contents
  • -l: list objects representing each file, each with fields containing `ls
      -l` output fields. See
      [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats)
      for more info

Examples:

ls('projs/*.js');
ls('-R', '/users/me', '/tmp');
ls('-R', ['/users/me', '/tmp']); // same as above
ls('-l', 'file.txt'); // { name: 'file.txt', mode: 33188, nlink: 1, ...}

Returns array of files in the given path, or files in the current directory if no path is provided.

mkdir([options,] dir [, dir ...])

mkdir([options,] dir_array)

Available options:

  • -p: full path (and create intermediate directories, if necessary)

Examples:

mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g');
mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above

Creates directories.

mv([options ,] source [, source ...], dest')

mv([options ,] source_array, dest')

Available options:

  • -f: force (default behavior)
  • -n: no-clobber

Examples:

mv('-n', 'file', 'dir/');
mv('file1', 'file2', 'dir/');
mv(['file1', 'file2'], 'dir/'); // same as above

Moves source file(s) to dest.

pwd()

Returns the current directory.

rm([options,] file [, file ...])

rm([options,] file_array)

Available options:

  • -f: force
  • -r, -R: recursive

Examples:

rm('-rf', '/tmp/*');
rm('some_file.txt', 'another_file.txt');
rm(['some_file.txt', 'another_file.txt']); // same as above

Removes files.

sed([options,] search_regex, replacement, file [, file ...])

sed([options,] search_regex, replacement, file_array)

Available options:

  • -i: Replace contents of file in-place. Note that no backups will be created!

Examples:

sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');
sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js');

Reads an input string from files, and performs a JavaScript replace() on the input using the given search_regex and replacement string or function. Returns the new string after replacement.

Note:

Like unix sed, ShellJS sed supports capture groups. Capture groups are specified using the $n syntax:

sed(/(\w+)\s(\w+)/, '$2, $1', 'file.txt');

set(options)

Available options:

  • +/-e: exit upon error (config.fatal)
  • +/-v: verbose: show all commands (config.verbose)
  • +/-f: disable filename expansion (globbing)

Examples:

set('-e'); // exit upon first error
set('+e'); // this undoes a "set('-e')"

Sets global configuration variables.

sort([options,] file [, file ...])

sort([options,] file_array)

Available options:

  • -r: Reverse the results
  • -n: Compare according to numerical value

Examples:

sort('foo.txt', 'bar.txt');
sort('-r', 'foo.txt');

Return the contents of the files, sorted line-by-line. Sorting multiple files mixes their content (just as unix sort does).

tail([{'-n': <num>},] file [, file ...])

tail([{'-n': <num>},] file_array)

Available options:

  • -n <num>: Show the last <num> lines of files

Examples:

var str = tail({'-n': 1}, 'file*.txt');
var str = tail('file1', 'file2');
var str = tail(['file1', 'file2']); // same as above

Read the end of a file.

tempdir()

Examples:

var tmp = tempdir(); // "/tmp" for most *nix platforms

Searches and returns string containing a writeable, platform-dependent temporary directory. Follows Python's tempfile algorithm.

test(expression)

Available expression primaries:

  • '-b', 'path': true if path is a block device
  • '-c', 'path': true if path is a character device
  • '-d', 'path': true if path is a directory
  • '-e', 'path': true if path exists
  • '-f', 'path': true if path is a regular file
  • '-L', 'path': true if path is a symbolic link
  • '-p', 'path': true if path is a pipe (FIFO)
  • '-S', 'path': true if path is a socket

Examples:

if (test('-d', path)) { /* do something with dir */ };
if (!test('-f', path)) continue; // skip if it's a regular file

Evaluates expression using the available primaries and returns corresponding value.

ShellString.prototype.to(file)

Examples:

cat('input.txt').to('output.txt');

Analogous to the redirection operator > in Unix, but works with ShellStrings (such as those returned by cat, grep, etc.). Like Unix redirections, to() will overwrite any existing file!

ShellString.prototype.toEnd(file)

Examples:

cat('input.txt').toEnd('output.txt');

Analogous to the redirect-and-append operator >> in Unix, but works with ShellStrings (such as those returned by cat, grep, etc.).

touch([options,] file [, file ...])

touch([options,] file_array)

Available options:

  • -a: Change only the access time
  • -c: Do not create any files
  • -m: Change only the modification time
  • -d DATE: Parse DATE and use it instead of current time
  • -r FILE: Use FILE's times instead of current time

Examples:

touch('source.js');
touch('-c', '/path/to/some/dir/source.js');
touch({ '-r': FILE }, '/path/to/some/dir/source.js');

Update the access and modification times of each FILE to the current time. A FILE argument that does not exist is created empty, unless -c is supplied. This is a partial implementation of touch(1).

uniq([options,] [input, [output]])

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

Examples:

uniq('foo.txt');
uniq('-i', 'foo.txt');
uniq('-cd', 'foo.txt', 'bar.txt');

Filter adjacent matching lines from input.

which(command)

Examples:

var nodeExec = which('node');

Searches for command in the system's PATH. On Windows, this uses the PATHEXT variable to append the extension if it's not already executable. Returns string containing the absolute path to command.

exit(code)

Exits the current process with the given exit code.

error()

Tests if error occurred in the last command. Returns a truthy value if an error returned, or a falsy value otherwise.

Note: do not rely on the return value to be an error message. If you need the last error message, use the .stderr attribute from the last command's return value instead.

ShellString(str)

Examples:

var foo = ShellString('hello world');

Turns a regular string into a string-like object similar to what each command returns. This has special methods, like .to() and .toEnd().

env['VAR_NAME']

Object containing environment variables (both getter and setter). Shortcut to process.env.

Pipes

Examples:

grep('foo', 'file1.txt', 'file2.txt').sed(/o/g, 'a').to('output.txt');
echo('files with o\'s in the name:\n' + ls().grep('o'));
cat('test.js').exec('node'); // pipe to exec() call

Commands can send their output to another command in a pipe-like fashion. sed, grep, cat, exec, to, and toEnd can appear on the right-hand side of a pipe. Pipes can be chained.

Configuration

config.silent

Example:

var sh = require('shelljs');
var silentState = sh.config.silent; // save old silent state
sh.config.silent = true;
/* ... */
sh.config.silent = silentState; // restore old silent state

Suppresses all command output if true, except for echo() calls. Default is false.

config.fatal

Example:

require('shelljs/global');
config.fatal = true; // or set('-e');
cp('this_file_does_not_exist', '/dev/null'); // throws Error here
/* more commands... */

If true, the script will throw a Javascript error when any shell.js command encounters an error. Default is false. This is analogous to Bash's set -e.

config.verbose

Example:

config.verbose = true; // or set('-v');
cd('dir/');
rm('-rf', 'foo.txt', 'bar.txt');
exec('echo hello');

Will print each command as follows:

cd dir/
rm -rf foo.txt bar.txt
exec echo hello

config.globOptions

Example:

config.globOptions = {nodir: true};

Use this value for calls to glob.sync() instead of the default options.

config.reset()

Example:

var shell = require('shelljs');
// Make changes to shell.config, and do stuff...
/* ... */
shell.config.reset(); // reset to original state
// Do more stuff, but with original settings
/* ... */

Reset shell.config to the defaults:

{
  fatal: false,
  globOptions: {},
  maxdepth: 255,
  noglob: false,
  silent: false,
  verbose: false,
}

Team

Nate Fischer Brandon Freitag
Nate Fischer Brandon Freitag

changelog

Change Log

Unreleased

Full Changelog

Closed issues:

  • Shelljs print stderr to console even if exec-only "silent" is true #905
  • refactor: remove common.state.tempDir #902
  • Can't suppress stdout for echo #899
  • exec() doesn't apply the arguments correctly #895
  • Travis CI currently broken #893
  • shell.exec('npm pack') painfully slow #885
  • shelljs.exec cannot find app.asar/node_modules/shelljs/src/exec-child.js #881
  • test infra: mocks and skipOnWin conflict #862
  • Support for shell function completion on IDE #859
  • echo command shows options in stdout #855
  • silent does not always work #851
  • Appveyor installs the latest npm, instead of the latest compatible npm #844
  • Force symbolic link (ln -sf) does not overwrite/recreate existing destination #830
  • inconsistent result when trying to echo to a file #798
  • Prevent require()ing executable-only files #789
  • Cannot set property to of [object String] which has only a getter #752
  • which() should check executability before returning a value #657
  • Bad encoding experience #456
  • phpcs very slow #440
  • Error shown when triggering a sigint during shelljs.exec if process.on sigint is defined #254
  • .to\(file\) does not mute STDIO output #146
  • Escaping shell arguments to exec() #143
  • Allow multiple string arguments for exec() #103
  • cp does not recursively copy from readonly location #98
  • Handling permissions errors on file I/O #64

Merged pull requests:

v0.8.2 (2018-05-08)

Full Changelog

Closed issues:

  • High severity vulnerability in shelljs 0.8.1 #842
  • Add test for ls() on a symlink to a directory #795
  • Harden shell.exec by writing the child process in a source file #782
  • shell.exec() doesn't respond correctly to config.fatal = true #735
  • Merge 'exec: internal error' with ShellJSInternalError #734
  • exec returning null from command #724
  • Only Get Stderr from Exec #371
  • Execute child.stdout.on before child.on("exit") #224

Merged pull requests:

  • Workaround codecov bug of miscalculation of coverage (#795) #838 (dwi2)
  • Update doc comments and regenerate README.md. #825 (Zearin)
  • chore: update contributing guidelines #817 (nfischer)
  • chore(lint): don't allow excess trailing newlines #816 (nfischer)
  • Remove separate "internal error" from exec #802 (freitagbr)

v0.8.1 (2018-01-20)

Full Changelog

Closed issues:

  • Exec failing with internal error when piping large output #818

Merged pull requests:

  • Revert "refactor(exec): remove paramsFile (#807)" #819 (nfischer)

v0.8.0 (2018-01-12)

Full Changelog

Closed issues:

  • Snyk vulnerability DB reporting command injection vulnerability in ShellJS #810
  • chore: upgrade nyc #803
  • Update CI to use Node v9 #799
  • Link to FAQ wiki section in our issue template #787
  • Is it possible to get a js library(file) for ShellJS #776
  • 48, #774
  • 47 #773
  • Exec function calls JSON.stringify on command #772
  • getting different result from terminal and with shelljs #769
  • test() does not support -w and -x options #768
  • Snyk "high severity" issue #766
  • Snyk "high security #765
  • ShellJS doesn't respect NPM Registry being set outside of it #761
  • Run second shell script #756
  • shelljs seems NOT compatible with nexe under CentOS 6.5 #754
  • Feature request: pushd/popd -q option #753
  • cat doesn't support '-n' option #750
  • shelljs run xcodebuild error #749
  • Add wrappers around fs.statSync and fs.lstatSync #745
  • Improve coverage for exec() #742
  • Improve coverage for head() #741
  • shelljs is no longer used in PDF.js #737
  • ls doesn't follow links to directories #733
  • Add test for ls regular-file.txt #732
  • Clean up common tests #714
  • Cant get encoding buffer to work on exec #675
  • Set up Codecov for the project #671
  • ShellJS: internal error Error: EBUSY: resource busy or locked, lstat 'C:\pagefile.sys' #514
  • Feature request: provide a way to skip option parsing #778
  • Switch to os.homedir() when we move to v4+ #683
  • Drop support for v0.12 #647
  • feature: echo -n #559
  • Don't kill the node process upon unexpected error #483
  • Echo doesn't return value ending in a trailing newline #476
  • Synchronous exec stalls permenantly when there is an error/w the shell #7

Merged pull requests:

v0.7.8 (2017-06-07)

Full Changelog

Closed issues:

  • Add node v8 to CI #729
  • Exec not working in Electron ! #726
  • is rechoir used anywhere? #723
  • ShellJS: internal error on shelljs.mkdir('myFile/myDir') #720
  • Can't make sed perform global replace #719
  • grep: option not recognized: l #717
  • Problems getting code, stdout, stderr #715
  • Copying hidden files fails on Windows 10 #711
  • How am I suppose to handle errors with ShellJS? #707
  • use cp('-r', './src', './dist') bug #705
  • Way to ignore files in globs. #699
  • Buffer constructor is deprecated #694
  • source command not working via exec method. #693
  • Would you be interested in a PR for open? #692
  • Get rid of common.platform in favor of process.platform #670
  • Passing empty string to cp throws internal error #664
  • Why does sed split files into an array, call replace on each line and rejoin? #645
  • feat: cp & mv should not overwrite recently created files #631
  • Echo tests unnecessarily run tests in own process #622
  • rm -rf on a symbolic link to a dir deletes its contents #587
  • "Cannot extract package" with node-webkit #181
  • EBADF, bad file descriptor #180

Merged pull requests:

v0.7.7 (2017-03-09)

Full Changelog

Closed issues:

  • Error output should be consistent across all platforms. #681
  • *CRITICAL data loss* shell.cp() Content of file is erased when trying to copy it to the folder it already belongs to #678
  • Use with webpack broken in 0.7.6 #667
  • Difference between bash ls -R and ShellJS ls -R with symlinks #666
  • Refactor which() (too many repeated code blocks) #656
  • find() raises error when unable to find any files matching, expected to return empty array. #653
  • Reformat the markdown in RELEASE.md #642
  • rm -rf doesn't work if the directory contains an asar archive in Electron #618
  • Add support for other file types in rm #617
  • Feature request: ls -L option #563
  • How to send SIGINT signal to child process launched with exec #518
  • feature request: option to add node_modules to the path for shelljs scripts #469
  • high cpu usage during synchronous exec #167

Merged pull requests:

v0.7.6 (2017-01-08)

Full Changelog

Closed issues:

  • unable to execute ionic command with shell js #640
  • How to increase ShellJS buffer size? #639
  • mkdir fails with non-normalized path #634
  • Move execPath into common #633
  • QUESTION: Feedback while an operation is running? #629
  • Test setup/cleanup is broken #621
  • Ignore temp directories when running lint #620
  • parseOptions should throw an error if the option string doesn't start with '-' #614
  • chore: LGTM.co is gone #595
  • refactor: objectAssign should refer to Object.assign if it exists, or the internal polyfill otherwise #592
  • parseOptions: allow a way to keep errors silent (exception only) #591
  • [Question] commands with multiple options / arguments? #589
  • feature: GNU Parallel #585
  • write to file #568
  • Cannot figure out how to disable globbing for rm #567
  • Switch to the ava test framework #560
  • Option not recognized #556
  • chore: add @freitagbr to LGTM maintainers #552
  • chore: set up dev branch #548
  • bug: cp() doesn't always copy everything #547
  • User-friendly lint command #544
  • Lint warning #542
  • chore: add nodejs v7 to CI #537
  • error.code is not always available #536
  • Add shx as a dependency for testing #525
  • Feature request: allow common.error\(\) to optionally not insert a prefix and optionally not print to console #523
  • Feature request: Add "shelljs.unlink" #519
  • Sed should allow a replacement string to contain \1 for match groups #507
  • Usage with neodoc #445
  • [ Feature idea ] synchronous sleep command #441
  • Improve test coverage #347
  • Add a way to prevent shell-expansion on commands (this issue is not for exec) #345
  • Chown #183
  • spawn EMFILE #81
  • Rewrite exec using execsync-ng (which uses node-ffi) #66
  • exec gets stuck on my Debian box #51
  • 100% cpu usage when a nodejs script goes side ways executing a command. #5

Merged pull requests:

v0.7.5 (2016-10-27)

Full Changelog

Closed issues:

  • Project objectives: there is some higher goal to achieve? #533
  • fs.existsSync is un-deprecated #531
  • Inadvertent breaking change to shell.test() #529
  • Add -u flag support for cp #526
  • API request: allow plugin.error\(\) to take an options parameter #522
  • FS Real Path error thrown when requiring shelljs #521
  • Question: passing code via pipe? #520
  • The performance in cp is different between 0.6.0 and 0.7.4 #517
  • ShellJS in Electron package don't find ffmpeg anymore #516
  • Exec issues with string option introduced in 0.7.4 #515
  • [ Feature ] SSH command #435

Merged pull requests:

v0.7.4 (2016-08-26)

Full Changelog

Closed issues:

  • fix: echo -e should not print "-e" #510
  • Wrong method signature in doc #498
  • readFromPipe should be a function with no arguments #485
  • TypeError: Cannot read property 'toString' of undefined #471

Merged pull requests:

v0.7.3 (2016-07-27)

Full Changelog

Closed issues:

  • expose execSync #494
  • Add a way to create commands that can receive from a pipe without being standalone commands #487
  • cp -r breaks when the directory contains a softlink #193
  • Redirect output to file fails #60
  • We need sed -n ? #38

Merged pull requests:

  • refactor: allow pipeOnly commands (methods on ShellStrings) #493 (nfischer)
  • refactor: glob by default for commands #492 (nfischer)
  • refactor: switch from notUnix to unix in wrap() #491 (nfischer)
  • refactor: switch common.extend() to Object.assign ponyfill #490 (nfischer)
  • fix: conflicting options now properly override each other #489 (nfischer)
  • refactor: expose plugin utils & add initial tests #484 (nfischer)

v0.7.2 (2016-07-25)

Full Changelog

Closed issues:

  • shelljs should not kill process if node call throws exception #473
  • cp work incorrectly when folder name contains '@' #463
  • Something went wrong #158

Merged pull requests:

  • fix: resolve a cylcic-dependency problem #482 (nfischer)
  • refactor: add wrapOutput option to auto-ShellString-ify command output #481 (nfischer)
  • refactor: move option parsing into common.wrap() #479 (nfischer)
  • refactor: hook new uniq() command using new format #478 (nfischer)
  • Fix mkdir malformed path #477 (nfischer)
  • fix: mkdir for invalid perms does not kill process #474 (nfischer)
  • feat(command): new command: uniq() #453 (joshi-sh)

v0.7.1 (2016-07-22)

Full Changelog

Closed issues:

  • cp -n doesn't work correctly #465
  • how can i run sudo apt-get install xtodotool by your plugin? #448
  • shell.js grep: internal error, Invalid regular expression #447
  • Stdout is empty on Git log command #439
  • Cannot read toString of null when using execSync #415
  • cp -R dir/ target fails to copy hidden files in dir #140
  • #mv Won't Work Across Disks #1

Merged pull requests:

v0.7.0 (2016-04-25)

Full Changelog

Closed issues:

  • exec('nohup node some.js &') #426
  • shelljs Breaks SemVer for Alpha and Pre-Release Versions #390
  • Copy not accepting source end with wildcards * when using -r on v0.6.0 #389
  • Support globbing in shjs #388
  • Refactor more commands to return ShellString #373
  • ln('-sf', './', '<destination>') is not linking the right folder #363
  • v0.6.0 - shell.cp('r', '/foo/*, '/bar') fails with /foo/* no such file or directory #342
  • Add documentup as a webhook #327
  • Dir glob breaks when in the middle of path #245
  • could you switch off wiki page? #233
  • ls globbing does not behave like shell, consider using glob.sync #225
  • Cannot run shell.exec('heroku config:push') -- just hangs #218
  • cp does not overwrite files by default #210
  • exec failed to return #208
  • CLI Version #202
  • Bracket expansion not working #176
  • "exec" causes LiveScript interpreter (lsc) to hang #160
  • Don't modify string prototype #159
  • exec\(...\).to\(file\) should work #154
  • Can't install shelljs locally instead of globally #136
  • shelljs and node 0.10.28 #125
  • Use case for global installed shelljs #123
  • Only get stdout from exec #92
  • What about other commands? #90
  • Flesh out example of exit() #73
  • exec doesn't work with qualified paths on windows #41
  • exec does not working in mingw bash in windows #17
  • Add support for cp -P option #413
  • cp -L: Incorrect behavior for symlinks to regular files #407
  • Edit the docs to emphasize ShellStrings and Pipes #398
  • Error message isn't always printed #372
  • Standardize command output #356
  • exec() doesn't clean up all temp files #353
  • Document that exec() options don't work on early versions of node #350
  • Add -f option to set() #344
  • Glob commands by default #343
  • rm -rf incorrect behaviour #332
  • Switch exec\(\) to use bash by default #281
  • pipe to proc #148
  • shell builtin #138
  • add timeout option for exec #132
  • shelljs cp handling symlinks badly #69

Merged pull requests:

v0.6.0 (2016-02-05)

Full Changelog

Closed issues:

  • option not recognized #334
  • Feature request: Metadata with ls #323
  • Gen-docs is broken #309
  • link -s is broken for files on Windows #301
  • Shelljs quits unexpectedly: #300
  • Failing tests on Windows #296
  • run-tests.js is broken for cmd.exe #294
  • Support echo-ing environment variables #291
  • Add Windows CI #287
  • Add tests for the shjs utility #280
  • Allow shjs utility to infer the extension for "filename." #278
  • Ability to read the stdout buffer line-by-line #277
  • Poor output for commands with multiple errors #267
  • Travis ci build status says "unknown" #266
  • wild card characters in filename not working as expected #262
  • shell.exec - read internal variable #260
  • cp and rename directory with -r doesn't match unix behavior #256
  • console.log.apply throwing TypeError: Illegal Invocation #255
  • How to exit on first error #253
  • why not support set 'cwd' when invoke execAsync ? #250
  • Not possible to check the failure of cd? #247
  • By default shelljs runs command in root #246
  • /usr/bin/env: node: No such file or directory #243
  • "Which" command not working properly on Windows Platform. #238
  • Arguments #237
  • sed() should accept multiple file arguments #231
  • shelljs.exec('aaa && bbb') blocks #229
  • Consider creating a GitHub Organization with more maintainers #223
  • [idea] Add chmodr function. #219
  • Execute a file #211
  • Where is standard error going to? #209
  • boolean return value for string.to() #205
  • common.error doesn't throw #199
  • Problems with exec (sync) on 0.12/io.js #197
  • cp --update flag #172
  • Is there a way to suppress pushd/popd output? #171
  • Cannot recursively list all *.js files #162
  • exec() breaks if executed in a deleted directory #157
  • shjs command always exits with zero code #133
  • touch command #122
  • Symbolic links are broken! #100
  • interpret -- as stdin #55
  • Error ENOTEMPTY when deleting a directory recursively. #49
  • Cross-platform way to add to PATH #32
  • mv fails on block, character, fifo #25
  • ls -l #22

Merged pull requests:

v0.5.3 (2015-08-11)

Full Changelog

Merged pull requests:

v0.5.2 (2015-08-10)

Full Changelog

Closed issues:

  • Cannot run shell.exec #217
  • write after end: internal error #206

Merged pull requests:

v0.5.1 (2015-06-05)

Full Changelog

Closed issues:

  • cd into home directory #9

Merged pull requests:

  • Fix issue #49: Retry rmdirSync on Windows for up to 1 second if files still exist. #179 (andreialecu)

v0.5.0 (2015-05-19)

Full Changelog

Closed issues:

  • Enter text to prompt #203
  • Find which shell is being used #195
  • Pass command line params to the make tool #188
  • Is it possible to call exec with a command containing new lines ? #177
  • The installation would break on Windows 7 #161
  • Q.ninvoke() returns undefined #153
  • installed shelljs on osx but reported error: npm ERR! 404 '%5B-g%5D' is not in the npm registry. #124
  • "ln" not found (OS X) #106
  • Using shelljs in a CLI app. #91

Merged pull requests:

v0.3.0 (2014-05-08)

Full Changelog

Closed issues:

  • grep() should fully support globing #118
  • sed() could support replacement function #115
  • How would you close an exec process that runs indefinitely? #113
  • listen for intermittent output of a long-running child process #111
  • Cannot find module 'shelljs' after installing shelljs with npm #109
  • Massive CPU usage on exec() windows #108
  • cp skipping dot files? #79
  • $variables in exec() aren't handled correctly #11
  • debug flag that prints commands instead of executing #8

Merged pull requests:

  • grep() support for globing, fixes #118 #119 (utensil)
  • make sed() support replacement function, fixes #115 #117 (utensil)
  • which() should only find files, not directories #110 (panrafal)
  • Added the New BSD license to the package.json. #105 (keskival)
  • Added win32 support to ln #104 (jamon)
  • Fix ln using bad paths when given abspaths. #89 (Schoonology)
  • Add ln support, including both -s and -f options. #88 (Schoonology)
  • add support for symlinking (junctions) on win32 #87 (jamon)

v0.2.6 (2013-09-22)

Full Changelog

Closed issues:

  • Versions 0.2.4 and 0.2.3 keep throwing strange errors #82
  • Add global pollution tests #33

v0.2.5 (2013-09-11)

Full Changelog

Closed issues:

  • shelljs.exec stalls on Red Hat when script is invoked with 'sudo -u username' #72

v0.2.4 (2013-09-11)

Full Changelog

v0.2.3 (2013-09-09)

Full Changelog

Merged pull requests:

  • Make shell.exec() treat process error return codes as shelljs errors #80 (nilsbunger)

v0.2.2 (2013-09-02)

Full Changelog

Closed issues:

  • which and node_modules #63
  • cannot install with nodejs 0.10.2 #57

Merged pull requests:

v0.1.4 (2013-05-10)

Full Changelog

Merged pull requests:

v0.1.3 (2013-04-21)

Full Changelog

Merged pull requests:

  • test('-L', badlink) should return true #56 (lge88)
  • exec options now allows silent:true with callback. #54 (iapain)
  • Add Zepto to README #53 (madrobby)

v0.1.2 (2013-01-08)

Full Changelog

Closed issues:

  • pushd/popd #24

Merged pull requests:

v0.1.1 (2013-01-01)

Full Changelog

Merged pull requests:

  • Work in progress: pushd/popd/dirs #47 (mstade)

v0.1.0 (2012-12-26)

Full Changelog

Closed issues:

  • test() for binary file? #45
  • Inconsistent behaviour of cp command with directories. #44
  • Executing SSH with ShellJs #43

Merged pull requests:

v0.0.9 (2012-12-01)

Full Changelog

Closed issues:

  • silent output #40
  • asynchronous exec #34

Merged pull requests:

  • Passed process arguments to executable script #36 (Zanisimo)

v0.0.8 (2012-10-11)

Full Changelog

Closed issues:

  • exec with callback should automatically be async #31
  • Exporting variables. #30
  • Detecting shelljs/node #27

Merged pull requests:

v0.0.7 (2012-09-23)

Full Changelog

Closed issues:

  • gh-pages: clicking 'fork me' just reloads the page #26
  • Not declared local var implies possible memory leak #21
  • Cannot echo a string that starts with - #20
  • Unexpected cp behaviour with directories #15

Merged pull requests:

v0.0.6 (2012-08-07)

Full Changelog

Merged pull requests:

v0.0.6pre2 (2012-05-25)

Full Changelog

v0.0.6pre1 (2012-05-25)

Full Changelog

v0.0.5 (2012-05-24)

Full Changelog

Closed issues:

  • global.key assigned value 'async' as a result of shell.exec(...) #12

Merged pull requests:

v0.0.5pre4 (2012-03-27)

Full Changelog

v0.0.5pre3 (2012-03-27)

Full Changelog

v0.0.5pre2 (2012-03-26)

Full Changelog

v0.0.5pre1 (2012-03-26)

Full Changelog

Closed issues:

  • rm() does not respect read/write modes #6

v0.0.4 (2012-03-22)

Full Changelog

Closed issues:

  • "For convenient iteration via for in, ..."? #4

v0.0.3 (2012-03-21)

Full Changelog

v0.0.2 (2012-03-15)

Full Changelog

v0.0.2pre1 (2012-03-03)

* This Change Log was automatically generated by github_changelog_generator