Skip to content

Instantly share code, notes, and snippets.

@ildar-shaimordanov
Last active April 24, 2023 07:26
Show Gist options
  • Save ildar-shaimordanov/b80420f71da791729816e4489c3dfda3 to your computer and use it in GitHub Desktop.
Save ildar-shaimordanov/b80420f71da791729816e4489c3dfda3 to your computer and use it in GitHub Desktop.
shell-hybrid

Shell hybrids

#!/usr/bin/env sh
# Excerpts from perlrun
# This example works on many platforms that have a shell compatible with Bourne shell
eval 'exec perl -x -S $0 ${1+"$@"}'
if $running_under_some_shell;
# ... a totally devious construct that will work under any of csh, sh, or Perl...
#eval '(exit $?0)' && eval 'exec perl -x -S $0 ${1+"$@"}'
#& eval 'exec perl -x -S $0 $argv:q'
# if $running_under_some_shell;
#!perl
use v5.16;
say "I am perl";
#!/usr/bin/env sh
""":"
python "$0" "$@"
exit $?
":"""
import sys
print(sys.argv)
exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment