Skip to content

Instantly share code, notes, and snippets.

@rummelonp
Last active December 11, 2015 06:08
Show Gist options
  • Save rummelonp/4556533 to your computer and use it in GitHub Desktop.
Save rummelonp/4556533 to your computer and use it in GitHub Desktop.
突然の死
#!/usr/bin/env bash
function suddenize() {
typeset text hit length i header footer
text=$1
hit=0
for i in $( seq 1 ${#text} ); do
hit=$(( $hit + $(expr $text[$i] : '[ -~]') ))
done
length=$(( ${#text} - $(( $hit / 2 )) + 2 ))
for i in $( seq 1 ${length} ); do
header='人'$header
footer='Y'$footer
done
echo _${header}_
echo > ${text} <
echo  ̄${footer} ̄
}
suddenize $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment