0.2.0 • Published 9 years ago

shell-escape v0.2.0

Weekly downloads
103,345
License
MIT
Repository
github
Last release
9 years ago

shell-escape

Escape and stringify an array of arguments to be executed on the shell

Install

npm install shell-escape

Example

simple

var shellescape = require('shell-escape');

var args = ['curl', '-v', '-H', 'Location;', '-H', 'User-Agent: dave#10', 'http://www.daveeddy.com/?name=dave&age=24'];

var escaped = shellescape(args);
console.log(escaped);

yields

curl -v -H 'Location;' -H 'User-Agent: dave#10' 'http://www.daveeddy.com/?name=dave&age=24'

A command suitable for being executed by the shell

advanced

var shellescape = require('shell-escape');

var args = ['echo', 'hello!', 'how are you doing $USER', '"double"', "'single'"];

var escaped = shellescape(args);
console.log(escaped);

yields

echo 'hello!' 'how are you doing $USER' '"double"' \''single'\'

and when run on the shell

$ echo 'hello!' 'how are you doing $USER' '"double"' \''single'\'
hello! how are you doing $USER "double" 'single'

License

MIT

balena-clichroot-sandboxenebular-privatenode-contrib-grove-base-hat@src-works/npm-ts-gulpparsable-bulk-user@annoai/shelljs-promise@infinitebrahmanuniverse/nolb-shel@everything-registry/sub-chunk-2749@ddcp/github-mirrordeploy-zone@djbelieny/mupdeploratordevup@dbux/common-nodefirefox-wrapperfirefox-nightly-prebuiltfs-pathdockerscriptember-cli-deploy-storybookember-cli-deploy-shember-cli-s3-syncencode-ffmpegentitlementsenv-to-envepub-checknode-nwnode-red-contrib-grove-air-quality-sensornode-red-contrib-grove-base-hatnode-red-contrib-grove-base-hat-bashnode-red-contrib-grove-base-hat-dtamnode-red-contrib-grove-capacitive-moisture-sensornode-red-contrib-grove-i2c-digital-light-sensornode-red-contrib-grove-rgb-led-striphttp-inspectorhubot-saynode-clipboardnode-img4toolnode-video-to-gifnode-sshnode-ssh-hannode-ssh-no-cpu-featuresnode-ssh-no-module-vernode-tello-edu@hubroeducation/mup-aws-beanstalkirestorenpm-adblocknpm-as-servicenpm-package-scriptsios-crashnode-unrarnode-unrar-update@heroku-cli/plugin-ci-v5@gravitywiz/cypress-plugin-gravity-wizjenkins-mochanpm2docker@heroku-cli/config@heroku-cli/plugin-apps-v5@heroku-cli/plugin-apps@http2/api@http2/edgedtflsecringrunt-i18n-abide@eluvio/elv-client-js@ff0000-ad-tech/build-source-automator@ff0000-ad-tech/tmpl-automatorheic-to-jpeg-middlewarehatimeria-hathghlvlheroku-ciherokuheroku-appsgulp-scss-lint@dwimm/servergit-lab-cligit-logsgit-auto-commit-msggifygithub-workflow-manager@fr0stf0x/mup-aws-beanstalk@fractal-code/mup-aws-beanstalkopsgangopal-webpack-bundler@k-kinzal/storepdfjampdf-mergepdf-merge-multistamp@izuna/node-sshkalabox-clijuto-mup-aws-beanstalk@josesanch/deployment@jswebfans/node-ssh@jwir3/node-ssh@khai96x/choose-text-editor@khai96x/git-utilslanguage-stringspneumonpm2-mysqlpilothousemup-node-version
0.2.0

9 years ago

0.1.0

10 years ago

0.0.1

11 years ago

0.0.0

11 years ago