Skip to content

Instantly share code, notes, and snippets.

@bobbyjam99-zz
Created November 3, 2011 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobbyjam99-zz/1336134 to your computer and use it in GitHub Desktop.
Save bobbyjam99-zz/1336134 to your computer and use it in GitHub Desktop.
簡易チャットシェル
#!/bin/sh
# 同一フォルダに生成される share ファイルを
# $ tail -f share
# すれば確認できます。
if [ $# -eq 0 ]; then
echo 'Please Input Your Name: "./chat.sh John"'
exit
fi
file_name=share
name=$1
join_date=`date '+%Y/%m/%d %R'`
trap 'echo "***** << $name Leaving! >> *****" >> $file_name; exit 1' 1 2 3 15
echo "***** << $name Joined! >> *****" >> $file_name
while :
do
read comment
com_date=`date '+%Y/%m/%d %R'`
echo "$com_date [$name] $comment" >> $file_name
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment