5
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

顔文字をランダムで出力するスクリプト

顔文字リストを作成します

kaomoji.md
(▰˘◡˘▰)
(゚Д゚)ハッ!
(≧ڡ≦*)
ヾ(。>﹏<。)ノ゙
(◞‿◟)
( ◞・౪・)◞
(  ◜◡◝  ) 
(º﹃º)
٩꒰๑・д・꒱۶
(*0_0)ノシ
(๑•₃•๑)
(๑•́ ₃ •̀๑)
( ◜◡‾)(‾◡◝ )
(๑′ᴗ‵๑)
꒰•̥̥ ﹏ •̥̥๑꒱
(╹〰╹)
(´・3・`)
(੭ु˙꒳<200b>˙)੭ु⁾⁾
。゚(゚∩´﹏`∩゚)゚。
(´◉_◉`)
(*˘︶˘*)
ヾノ。ÒㅅÓ)ノシ
⁽˙³˙⁾◟( ˘•   ̫ •˘ )◞⁽˙³˙⁾)
(◜◡‾c彡☆)◡◝))

ランダムで顔文字を出力するスクリプトを作成します。

kaomoji_rand.sh
#!/bin/bash

TEXT='/Users/soramugi/Documents/kaomoji/kaomoji.md'
WCNUM=`cat $TEXT | wc -l`
RUNNUM=$(( (RANDOM % $WCNUM ) + 1 ))

cat $TEXT | awk "NR==$RUNNUM"

完成です。

なまえ@soramugi-Air ~ $ source kaomoji_rand.sh
(๑′ᴗ‵๑)

エイリアスを貼ってツイート出来るようにしておけば幸せ

alias tweet='ruby ~/command_tweet.rb'
alias tweetkao='tweet `source ~/kaomoji_rand.sh`'
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
5
Help us understand the problem. What are the problem?