Page 1 of 1

Bash Poetry Contest

Posted: 2010-07-05 12:40
by Soul Singin'
In another thread, I began writing some Bash Poetry.

Code: Select all

printf "\n\tRoses are red,\n\tViolets are blue.\n\tWhen %b is dead,\n\tI %b or two.\n\n" $(env|grep -iE "^desk|^term"|sort|head -n1|sed 's/^.*=//') "$(whatis kill|sed 's/\s(1).*to//')"
But I never had much of a head for rhythm and rhyme, so let's see if you can do better!

Rules
  1. The "poem" must be run from a Bash prompt. (No scripts allowed).
    .
  2. Due to an earlier incident in which a forum member dropped a fork bomb into obfuscated code, I think that there should be a . NO obfuscation . rule.
    1. I want to have fun. I don't feel like dealing with the consequences of rm -rf *, etc.
    2. @ moderators -- Please lock this thread if malicious commands appear.
    .
  3. May the best poet win!
.

Re: Bash Poetry Contest

Posted: 2010-07-05 14:19
by Pick2
There was this one dude called Soul Singin'
His Rantingly posts he'd keep a Flingin'
While reading his Bash
My head went kur-splash
I woke up with my ears still a Ringin'

I forgot about the bash part :D
Programming and poetry ... Diametrically opposed !

Re: Bash Poetry Contest

Posted: 2010-07-05 14:38
by Soul Singin'
Pick2 wrote:There was this one dude called Soul Singin' ...
Love it !!! :D
.

Re: Bash Poetry Contest

Posted: 2010-07-05 16:42
by nadir
I guess i won't win the contest:

Code: Select all

$ cat my_confusion.sh 
#!/bin/bash


INPUT_FILE="/usr/share/common-licenses/GPL-3"
OUT_FILE="my_save.txt"
RESULT="my_poem.txt"

clear; echo

exec 6>&1
exec >$OUT_FILE

sed -n '13,20p'  "$INPUT_FILE"

exec 1>&6 6>&- 
exec 2>/dev/null

dadadodo  -c 1   "$OUT_FILE" > "$RESULT"

echo "
"
cat   $RESULT

exit 0
But it took me a bit more than half an hour to figure it out. Lousy result for that, no?
Main problem is i can't deal with texts (cut,split and all that). I think you got the idea.
Put it in a one-liner someone, do a bit of formatting and voila: you got a sossegonized poem.

I know the code is lousy. Thats the stage i am at...
If oyu run it and it will burn your house down: I am already broken. You have to live with it.
I am serious with that.

Ups:
" 1. The "poem" must be run from a Bash prompt. (No scripts allowed)."
Guess i gotta start over later...(cut the text out of the liscence -somehow- and pipe it to dadadodo -somehow-...)

Re: Bash Poetry Contest

Posted: 2010-07-05 17:20
by nadir
ok, somehow a start:

Code: Select all

$ sed -n '13,20p' /usr/share/common-licenses/GPL-3 > save_it.txt &&  dadadodo -c 1 save_it.txt

Re: Bash Poetry Contest

Posted: 2010-07-05 17:27
by Soul Singin'
nadir wrote:But it took me a bit more than half an hour to figure it out. Lousy result for that, no?
nadir wrote:I know the code is lousy. Thats the stage i am at...
But learning is all about "trial and error." You cannot learn if you do not make a lot of errors.

And look at what you learned! You learned how to redirect input and output and you learned how to use sed to isolate a few lines of text. That's a good start.
nadir wrote:Put it in a one-liner someone, do a bit of formatting and voila: you got a sossegonized poem.
OK. So all you need is to make it more concise. Using a hyphen tells dadadodo to read from STDIN. Then you use 2> /dev/null to strip away dadadodo's noise (i.e. STDERR).

Code: Select all

sed -n '13,20p' /usr/share/common-licenses/GPL-3 | dadadodo -c 1 - 2> /dev/null
Edit: Redirect to /dev/null !!! See. I'm learning too. I have to learn more about redirection!
.

Re: Bash Poetry Contest

Posted: 2010-07-05 17:56
by jheaton5
:?:

Code: Select all

jheaton5@sid:~$ sed -n '13,20p' /usr/share/common-licenses/GPL-3 > save_it.txt &&  dadadodo -c 1 save_it.txt
bash: dadadodo: command not found
jheaton5@sid:~$ sed -n '13,20p' /usr/share/common-licenses/GPL-3 | dadadodo -c 1 - 2>1
jheaton5@sid:~$ 

Re: Bash Poetry Contest

Posted: 2010-07-05 18:04
by Soul Singin'
jheaton5 wrote:

Code: Select all

bash: dadadodo: command not found

Code: Select all

apt-get install dadadodo
.

Re: Bash Poetry Contest

Posted: 2010-07-05 18:46
by nadir
Thanks Soul.
So here is my final feed:

Code: Select all

clear && sed -n '13,20p' /usr/share/common-licenses/GPL-3 | dadadodo -c 1 - 2>/dev/null | cut --delimiter=" " -f 1-4
If the first run doesn't sound at minimum like sossego or like shakesbeer, run it again.*
Soul will get half of the prize-money (as he did the work), i will get the other half cause i had the idea. :D

*that was one result i did like:
We, the GNU General
for most software for
your freedom to share
your freedom to share
change the GNU General
GNU General Public License
Lets hear for more.

Re: Bash Poetry Contest

Posted: 2010-07-05 19:02
by Soul Singin'
I like this one from the original:
By contrast, the works are designed to take away your freedom to
guarantee your freedom to take away your freedom to take away your
freedom to take away your freedom to guarantee your freedom to share
and other change the licenses for most software and other practical
works.
nadir wrote:Lets hear for more.
+1
.

Re: Bash Poetry Contest

Posted: 2010-07-08 12:45
by paivakil
Using:-

Code: Select all

printf "\n\tRoses are red,\n\tViolets are blue.\n\tWhen %b is dead,\n\tI %b or two.\n\n" $(env|grep -iE "^desk|^term"|sort|head -n1|sed 's/^.*=//') "$(whatis kill|sed 's/\s(1).*to//')"
I get
Licensor shall mean the
entities that entity shall
mean the License.
and
Licensor shall mean the
union of this definition,
entity authorized by or
by or entity shall
copyright owner or are
owner or indirect to

Re: Bash Poetry Contest

Posted: 2010-07-09 21:57
by dbbolton
Soul Singin' wrote:[*]Due to an earlier incident in which a forum member dropped a fork bomb into obfuscated code, I think that there should be a . NO obfuscation . rule.
In response the mention of said "incident", presented below is a list of tasks that a user must have completed in order that he or she execute said "fork bomb". The user must have:

1. Recognized to which interpreter the code block should be passed,
2. Copied the text from the post that contained said "fork bomb" and saved it as a local file*,
3. Added an appropriate she-bang line from No. 1.**,
4. Made that file executable**,
5. Called that file from a shell**,

and finally, the most important criterion:

The user must have rectified the syntax errors on the last line:

Code: Select all

Scalar found where operator expected at ./alleged-fork-bomb line 6, near "$C $S"
	(Missing operator before $S?)
syntax error at ./alleged-fork-bomb line 6, near ""$2[2]$0[1]$0[0] \"";"
syntax error at ./alleged-fork-bomb line 6, near "$C $S"
Execution of ./alleged-fork-bomb aborted due to compilation errors.
If that obfuscated code caused any damages to any user or any user's property, the user in question irrefutably went out of his or her way to bring the consequences about himself or herself.

The reason that this alleged forkbomb was posted possibly revolved around the intent to pose a reminder that one should never execute any program or code unless one trusts the author and/or has a complete understanding of what the code will do-- an intent that may or may not have been prompted by a previous post containing obfuscated code-- and possibly did not, in any capacity, revolve around any ill will or intent to deal damage to other users or their property.

In light of the aforementioned propositions, any accusation, whether implicit or explicit, of such ill will on the part of the code's author is utterly misguided.

Perhaps, and only perhaps, these propositions ought to be considered before the issue of an obtrusive warning to the other schoolchildren to behave lest they next be banished to the corner with the dunce hat. While the context in which the prohibition of obfuscated code was presented is arbitrary, the rule is appropriate.

Notice: This post was written with the sole intent of clarifying perceived misunderstandings about said "incident", whether or not those misunderstandings in fact exist, and is no way intended to malign or otherwise defame the author or authors of any text contained herein.

Let it be known that the proscription of obfuscated code is agreeable and just.

* - Or, awkwardly passed the five long lines to the interpreter on the command line and fixed the subsequent quotation problems.
** Of course, these steps could be substituted with a passing of the file containing the code block to the correct interpreter from a shell.

Re: Bash Poetry Contest

Posted: 2010-07-09 22:33
by Soul Singin'
[[ Post deleted ]]
.

Re: Bash Poetry Contest

Posted: 2010-07-09 23:24
by nadir
Back to the topic and hint for Pick2
(you may still win the contest,
just do it like this :-)
$ echo "
> most_easy
>
> duh, bolton, have it done?
> the bomb, bonmot
> a frog, the gun
> i ask:
> my $shell
>
> Have you done wrong?
>
> A soul, came run:
> there was a bomb!
> Complain: gone, gone
> Thats what
> i ask:
>
> Where is:
> the Fun?
> "
$
Not exactly Shakespeare, but the guidelines don't allow the use my little helpers...
It is a single command, from what i understand, so it should be taken into the final round
(i really need the money... )

It's a top-secret bavarian-style of poems (not that boring japanese stuff).
It's called:
inardiburgisgeharse.
(Bavarian? :roll: Hint, hint hint: have a beer. Better a sixer. Both of you)

greetings.

Edit: to edit.

Re: Bash Poetry Contest

Posted: 2010-07-10 01:52
by dbbolton
I called Saul, and he drafted it for me. Note the conspicuous lack of identifying pronouns.

nadir: I will take you up on your generous offer and have some of your beers.*


But on a serious note, I have a few ideas for some bash poems-- I just have one question. Does the output have to be the poem, or can the command itself be the poem (assuming that it's valid)?



* - a quote from that episode

Re: Bash Poetry Contest

Posted: 2010-07-10 02:40
by Soul Singin'
dbbolton wrote:But on a serious note, I have a few ideas for some bash poems-- I just have one question. Does the output have to be the poem, or can the command itself be the poem (assuming that it's valid)?
Surprise us!
.

Re: Bash Poetry Contest

Posted: 2022-12-03 06:51
by clie09
Id=`printf "THIS IS IT" | sed -u "s:IS::" | awk '$2' | bash -c "cat $(and=mouse)"

&& for i in "10" $minutes; do echo "something until $it is"; done

`&& There="is an" echo $Id | ALWAYS="JUST" sed "s:

IS IT:${N}E $VER GOING $(TO="BE WHAT YOU'RE AS") KING - FOR, that :"|cut -d- -f1

|WAS_JUST_TOO_DEEP= IS_WHAT_THE= cat|

$OWNER sed "s:GOING$TO_HAPPEN:BASH$ING $THE SCRIPTING $LIKE$THAT IS:" $WRONG



-Admin Edit: Until Al Gore gets here to verify this string of what may be beautiful code, lets break it up a bit for those who would unknowingly input random Internet text.

Re: Bash Poetry Contest

Posted: 2022-12-03 09:43
by sunrat
:lol: 12 year old topic!
zombie-thread.jpg

Re: Bash Poetry Contest

Posted: 2022-12-04 00:05
by clie09
I believe this is still relevant today! It started as a conversation with a colleague about why all the hype with python these days when we could code the same thing up in bash in a fraction of the time that runs faster and uses less memory - was trying to prove a point here why in many cases python is easier to maintain:

Note: this code will only execute correctly as a one-liner...I swear it is harmless, but this is also a strategy that can be used for nefarious purposes.

Admin edit to remove posted code. - Another admin decided to be cautious and not allow your code to be posted as a one liner and you reposted it. Sorry, can't allow that or override his decision.
If anyone wants to try your code, I'm sure they can reconstruct it from your first post.