The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,225 other subscribers

Archive for the ‘Polyglot’ Category

llamasoft/polyshell: A Bash/Batch/PowerShell polyglot!

Posted by jpluimers on 2023/03/16

PolyShell is a script that’s simultaneously valid in Bash, Windows Batch, and PowerShell (i.e. a polyglot).

[Wayback/Archive] llamasoft/polyshell: A Bash/Batch/PowerShell polyglot!

Need to check this out, as often I have scripts that have to go from one language to the other or vice versa.

Maybe it enables one language to bootstrap functionality in the other?

The quest

The above polyglot started with a quest to see if I can could include some PowerShell statements in a batch file with two goals:

  1. if the batch file started from the PowerShell command prompt, then execute the PowerShell code
  2. if the batch file started from the cmd.exe command prompt, then have it start PowerShell with the same command-line arguments

The reasoning is simple:

  1. PowerShell scripts will start from the PATH only when PowerShell is already running
  2. Batch files start from the path when either cmd.exe or PowerShell are running

Lots of users still live in the cmd.exe world, but PowerShell scripts are way more powerful, and since PowerShell is integrated in Windows since version 7, so having a batch file bootstrap PowerShell still makes sense.

Since my guess was about quoting parameters the right way, my initial search for the link below was [Wayback/Archive] powershell execute statement from batch file quoting – Google Search.

I have dug not yet into this, so there are still…

Many links to read

These should give me a good idea how to implement a polyglot batch file/PowerShell script.

–jeroen

Posted in *nix, *nix-tools, bash, bash, Batch-Files, Development, JavaScript/ECMAScript, Perl, Polyglot, Power User, PowerShell, Scripting, Software Development | Leave a Comment »

C to Go “cheat sheet” at C, Go – Hyperpolyglot

Posted by jpluimers on 2018/03/06

Great cheat sheet [WayBackC, Go – Hyperpolyglot

via: [WayBack] C to Go “cheat sheet”Try Go. You might like it.http://golang.org – Kevin Powick – Google+

 

Posted in C, Development, Go (golang), Polyglot, Software Development | Leave a Comment »

Lightweight Markup: Markdown, reStructuredText, MediaWiki, AsciiDoc, Org-mode – Hyperpolyglot

Posted by jpluimers on 2017/05/03

A great table with comparison of various constructs in Lightweight Markup: Markdown, reStructuredText, MediaWiki, AsciiDoc, Org-mode – Hyperpolyglot

It works much better than the examples in Lightweight markup language – Wikipedia, the free encyclopedia (which does include more languages).

As I’ve switched to “all source – including docs – should be in text format” years ago, I’m a heavy markdown user, but also use reStructuredText, so this table is of great help.

Reminder to self: reStructuredText does not support strikethrough out of the box.

–jeroen

Posted in Development, Lightweight markup language, MarkDown, Polyglot, reStructuredText, Software Development | Leave a Comment »

 
%d bloggers like this: