0.2.0 • Published 10 years ago

shell-escape v0.2.0

Weekly downloads
103,345
License
MIT
Repository
github
Last release
10 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

chroot-sandboxenebular-privatenode-contrib-grove-base-hat@src-works/npm-ts-gulpparsable-bulk-user@annoai/shelljs-promise@infinitebrahmanuniverse/nolb-shel@everything-registry/sub-chunk-2749tamia-changelogt2-cliwirebird-clientwindows-docker-machinewinrarjswebchat-cliwpsyncwpvip-cliwp-local-dockerxlsx2sqltemplate-anythingspeech-serverstartfromvue-cli-plugin-ice-buildervue-cli-plugin-ut-buildervideofyvideofy-plus@djbelieny/mup@cocalc/frontend@cocalc/jupyter@cocalc/backend@cocalc/util-node@cs-chatbots/webchat-cli@commonshost/core@commonshost/edge@coyle-club/kubectl-ts@pdkit/cli@rtscripts/rtorrent-commandsjenkins-mochakalabox-cliirestorejuto-mup-aws-beanstalklanguage-stringsmup-node-versionstrider-gitstrider-hgstrider-localstenoread-nodejstsscheckertiny-care-terminaltradie-utils-flowtoml-to-envtls-keygentogiftiny-git-terminaltwain-scanner-pdf@appirio/ezbake@anhdayem818/capture_electron@amphibian/linter@atomic-object/tscli@avorra/mup-aws-beanstalk@asserted/runner@adpt/cli@bb-tools/markdown-magic-utils@bockit/sh@brunwig/mup-aws-beanstalk@ckeditor/ckeditor5-dev-release-tools@chemzqm/solargraph-utils0xble@ddcp/github-mirror@dbux/common-nodeyarmdwebpack-php-loaderwebpack-node-test-runnerunimailunparse-argsunpackrzeronet-cryptozoj-sandbox@gravitywiz/cypress-plugin-gravity-wiz@fractal-code/mup-aws-beanstalk@fr0stf0x/mup-aws-beanstalk@hubroeducation/mup-aws-beanstalk@http2/api@http2/edge@heroku-cli/plugin-apps-v5@heroku-cli/plugin-ci-v5@heroku-cli/config@heroku-cli/plugin-apps@ff0000-ad-tech/build-source-automator@ff0000-ad-tech/tmpl-automator@eluvio/elv-utils-js@eluvio/elv-client-js@kyometori/yt-downloader@livecycle/compose-tunnel-agent@livecycle/docker-proxy@lytesoft/mup-aws-beanstalk@magicdawn/x-args@nathantreid/node-ssh@fabricate-tools/cli@mindhive/deploy@mittwald/cli@jwir3/node-ssh
0.2.0

10 years ago

0.1.0

11 years ago

0.0.1

12 years ago

0.0.0

12 years ago