polygotscripts

A single executable script format that is operable in both UNIX and WINDOWS environment.

https://github.com/chewkeanho/polygotscripts

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.2%) to scientific vocabulary

Keywords

batch-script linux macos polygot posix-shell powershell powershell-script unix windows
Last synced: 6 months ago · JSON representation ·

Repository

A single executable script format that is operable in both UNIX and WINDOWS environment.

Basic Info
  • Host: GitHub
  • Owner: ChewKeanHo
  • License: mit
  • Language: Batchfile
  • Default Branch: main
  • Homepage:
  • Size: 1.54 MB
Statistics
  • Stars: 19
  • Watchers: 1
  • Forks: 1
  • Open Issues: 1
  • Releases: 4
Topics
batch-script linux macos polygot posix-shell powershell powershell-script unix windows
Created almost 3 years ago · Last pushed about 2 years ago
Metadata Files
Readme License Code of conduct Citation Security

README.md

Holloway's Polygot Scripts

Holloway's Polygot Scripts

This is a reference repo serving as a sharing and quality control for my polygot scripts: The same script can be operated in both UNIX and WINDOWS OSes. This script is generally used various multi-system distributions and fleet control initialization where maintaining multi-OSes end products can be easily done.

Why It Matters

Mainly for multi-os decentralized packaging usage:

  1. 1 common starting point - less communication errors; more control over the package installation.
  2. Maintainable and documentable - 1 single start point; 1 set of documentation only; 1 easy way to maintain the starting point command.
  3. Simple and modular - can easily drill down the errors due to modularization and use the most basic commands available in both OSes.

The Products

The products are located in the root repository in various versions:

  1. posix-batch-powershell.sh.ps1.cmd - capable of running in:

    1. POSIX Shell mode; AND
    2. BATCH mode; AND
    3. POWERSHELL mode.
  2. posix-batch.sh.cmd - capable of running in:

    1. POSIX Shell mode; AND
    2. BATCH mode; AND

[!NOTE] PowerShell knows how to execute batch script. No auto-correction is required.

  1. posix-powershell.sh.cmd - capable of running in:
    1. POSIX Shell mode; AND
    2. POWERSHELL mode.

[!IMPORTANT] When executed in Batch mode, it will auto-correct itself to PowerShell and execute it from there.

  1. posix-powershell.sh.ps1 - capable of running in:
    1. POSIX Shell mode; AND
    2. POWERSHELL mode.

File Extensions

While UNIX systems do not demand for file extensions, Windows do have its complex and heavy requirement for it. As a practice, the file extension shall always be lead by the UNIX (.sh*) and ends with Windows (either *.cmd for Batch initialization or *.ps1 for PowerShell initialization).

For the highest portability, I recommend keeping the initialization with Batch mode since its execution can auto-correct to PowerShell mode when available (Refer posix-powershell.sh.ps1 for how it's done).

Hence, this is the Polygot script's file extension I would recommend:

filename.sh.ps1.cmd # start by Batch filename.sh.cmd.ps1 # start by PowerShell filename.sh.cmd filename.sh.ps1

Maintain Simplicity for Sanity

It is always advisable to keep this script as simple as calling the OS-specific initializing command rather than develop a fat binary like executable script.

In case you don't know, coding all 3 types of scripts and compile into 1 manually can be a cumbersome task as the output file can easily become 3x larger. Should it be too complex, you should use proper programming languages like Go or Rust.

Please DO NOT abuse it. You have been warned!

License

This project is licensed under MIT License.

Owner

  • Name: (Holloway) Chew, Kean Ho
  • Login: ChewKeanHo
  • Kind: organization
  • Email: hello@hollowaykeanho.com
  • Location: Malaysia

Personal Group for HollowayKeanHo personal brand and his products & services.

Citation (CITATION.cff)

# WARNING: auto-generated by AutomataCI

cff-version: "1.2.0"
type: "software"
date-released: "2024-02-19"
title: "Polygot Scripts"
version: "1.3.0"
license: "MIT"
repository: "https://github.com/ChewKeanHo/PolygotScripts"
repository-code: "https://github.com/ChewKeanHo/PolygotScripts"
repository-artifact: "https://github.com/ChewKeanHo/PolygotScripts"
url: "https://github.com/ChewKeanHo/PolygotScripts"
contact:
  - affiliation: "(Holloway) Chew, Kean Ho"
    email: "hello@hollowaykeanho.com"
    website: "https://www.hollowaykeanho.com"
abstract: |-
  A single executable script format that is operable in both UNIX and WINDOWS
  environment.
message: |-
  Please cite and reference this repository accordingly.
authors:
  - given-names: "Kean Ho"
    family-names: "Chew"
    email: "hollowaykeanho@gmail.com"
    affiliation: "Independent"
    orcid: "https://orcid.org/0000-0003-4202-4863"
  - given-names: "Cory"
    family-names: "Galyna"
    email: "124406765+corygalyna@users.noreply.github.com"
    affiliation: "Independent"
identifiers:
  - type: doi
    value: "10.5281/zenodo.000000"
    description: "Paper"
keywords:
  - "windows"
  - "macos"
  - "linux"
  - "unix"
  - "powershell"
  - "batch-script"
  - "powershell-script"
  - "polygot"
  - "posix-shell"

GitHub Events

Total
  • Watch event: 2
Last Year
  • Watch event: 2

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 2
  • Total pull requests: 0
  • Average time to close issues: 3 days
  • Average time to close pull requests: N/A
  • Total issue authors: 2
  • Total pull request authors: 0
  • Average comments per issue: 0.5
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • hollowaykeanho (1)
  • JeanShuralyov (1)
Pull Request Authors
Top Labels
Issue Labels
Enhancement (1) Released (1) Will Not Fix/Implement (1) Discussion (1) Documentation (1)
Pull Request Labels

Dependencies

.github/workflows/git-push.yml actions
  • actions/checkout v4 composite