Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Convoluted Echo

by KurtSchwind (Chaplain)
on May 22, 2015 at 18:19 UTC ( [id://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, '>', 'ce.py' or die "Cannot open ce.py: $!\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 = File.new(\\\"ce.sh\\\", \\\"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 ce.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 ce.py");
--
“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 (Deacon) 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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://1127493]
Approved by GotToBTru
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (8)
As of 2024-03-28 12:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found