polyshell
v1.0.3
Published
Combines Microsoft Windows and POSIX, shell scripts into a single cross platform script
Downloads
3
Maintainers
Readme
polyshell
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!