Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Convoluted Echo

by KurtSchwind (Chaplain)
on May 22, 2015 at 18:19 UTC ( #1127493=obfuscated: print w/replies, xml ) Need Help??

So let's say you are on a *nix machine and you need an application that echos what you type. And let's further say that you want to use perl, python, ruby and shell to do it. I bring you convoluted echo. A perl script the writes and executes a python script that's and executes a ruby script which writes and executes a shell script to echo your command line arguments.

Happy Memorial Day

#!/usr/bin/perl my $echo = q{}; open my $py, '>', '' or die "Cannot open $!\n"; $py->print("#!/usr/bin/python\n\n"); $py->print("import os\n\n"); $py->print("fo = open(\"ce.rb\",\"w\")\n\n"); $py->print("fo.write(\"#!/usr/bin/ruby\\n\")\n"); $py->print("fo.write(\"out_file =\\\"\\\", \\\"w\\\ +")\\n\")\n"); $py->print(q{fo.write("out_file.puts(\"#!/bin/sh\\n\\necho $*\\n\\ +")\n")}); $py->print("\n"); $py->print(q{fo.write("out_file.close\n\n")}); $py->print("\n"); $py->print("\n"); foreach my $a (@ARGV) { $echo .= " ".$a; # $py->print( " $a "); } $py->print(q{fo.write("system(\"/bin/sh }); $py->print(" $echo "); $py->print(q{\")\n")}); $py->print("\nfo.close()\n"); $py->print("os.system(\"/usr/bin/ruby ce.rb\")\n"); close $py; system("/usr/bin/python");
“For the Present is the point at which time touches eternity.” - CS Lewis

Replies are listed 'Best First'.
Re: Convoluted Echo
by ww (Archbishop) on May 22, 2015 at 22:02 UTC

    Ok, ok, awreddy. + + for simple wackiness.

    If you didn't program your executable by toggling in binary, it wasn't really programming!

Re: Convoluted Echo
by FreeBeerReekingMonk (Chaplain) on May 26, 2015 at 15:42 UTC

    Reminds me of a certain version of OS that opened a new hidden DOS interpreter to run a new graphical program each time you double-clicked on one.... yes, I'm talking about Bochs

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://1127493]
Approved by GotToBTru
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2018-07-22 00:29 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (451 votes). Check out past polls.