JSPM

polyshell

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q17107F

Combines Microsoft Windows and POSIX, shell scripts into a single cross platform script

Package Exports

  • polyshell

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (polyshell) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

polyshell Build Status Build status

Combines Microsoft Windows and POSIX, shell scripts into a single cross platform script

Installation

As a module

npm install polyshell --save

As a program

npm install polyshell -g

Usage

As a module

var fs = require('fs');
var polyshell = require('polyshell');

var polyshellStream = polyshell(fs.createFileStream('script.bat'), fs.createFileStream('script.sh'));
polyshellStream.pipe(fs.createWriteStream('script.cmd'));

As a program

polyshell script.bat script.sh > script.cmd

Example

hello.bat

@echo off
echo Hello

hello.sh

#!/bin/sh
echo Hello
polyshell hello.bat hello.sh > hello.cmd

On Windows

c:\project>hello.cmd
Hello

c:\project>

On Linux/Unix/OSX etc

user$ chmod +x hello.cmd
user$ ./hello.cmd
Hello
user$ 

Limitations

To run on as many systems as possible, the Windows script should be a Batch file, and the POSIX script should be a Bourne shell file.

When executing on POSIX systems, the script will run uisng the default shell. This is almost always the Bourne shell, however there is no guarantee that the default has not been changed!