Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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, '>', '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 (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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2018-01-22 01:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (230 votes). Check out past polls.

    Notices?