🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

bash-parser

Package Overview
Dependencies
Maintainers
4
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bash-parser

Standard compliant bash parser

0.2.0
Source
npm
Version published
Maintainers
4
Created
Source

bash-parser

Parses bash source code to produce an AST

Travis Build Status Coveralls NPM module NPM downloads

Installation

npm install --save bash-parser

Usage

  const parse = require('bash-parser');
  const ast = parse('echo foo>file.txt');

ast is of the following form:

{
	type: 'list',
	andOrs: [{
		type: 'andOr',
		left: [{
			type: 'simple_command',
			name: 'echo',
			suffix: {
				type: 'cmd_suffix',
				list: [
					'foo',
					{
						type: 'io_redirect',
						op: '>',
						file: 'file.txt'
					}
				]
			}
		}]
	}]
}
  • cash - This parser should become the parser used by cash (and also vorpal)
  • nsh - This parser should become the parser used by nsh
  • js-shell-parse - bash-parser was born as a fork of js-shell-parse, but was rewritten to use a jison grammar
  • jison - Bison in JavaScript.

License

The MIT License (MIT)

Copyright (c) 2016 vorpaljs

FAQs

Package last updated on 21 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts