两个无聊的脚本

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
roylez
帖子: 1928
注册时间: 2005-10-04 10:59
来自: 上海

两个无聊的脚本

#1

帖子 roylez » 2008-11-19 11:58

网上看来的,挺有意思的。

clock.sh

代码: 全选

#!/bin/bash
# clock.sh

# the script is executed inside a while without conditions
while :                                                                                  
do
 # time and date are formatted to show HH:MM:SS YYYY-MM-DD
 cmd=`date +"%H:%M:%S %F"`
 
 # cursor's current position is saved through an escape sequence
 echo -n -e "\033[s"

 # Uncomment the next two lines to clean up the whole first line, although it causes a lot of blinking
 #tput cup 0 0    # positions on row 0 col 0 (left top corner)
 #tput el         # cleans from position to end of line

 # to place the clock on the appropriate column, subtract the length of 'HH:MM:SS YYYY-MM-DD', which is 19,
 # from the total number of columns
 C=$((`tput cols` - 19))
 tput cup 0 $C    # positions cursor at row 0 col $C

 # clock will be shown green inverted
 # setaf 2 = green, smso = inverted
 COLOR=`tput setaf 2; tput smso`

 # back to normal screen colors
 NORMAL=`tput sgr0`
 
 # print the time-date output on the above position
 echo -n $COLOR$cmd$NORMAL
 
 # restore the cursor to whatever was its previous position
 echo -n -e "\033[u"
 
 # script is executed every second
 sleep 1
done
dance.sh

代码: 全选

#! /usr/bin/sh -i
POS=`tput cup 0 0`
clear
while [ 1 ]
do
echo "${POS}"
tput bel
echo " o "
echo "^|\ "
echo " /\ "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "^|^ "
echo " >\ "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "v|^ "
echo "/< "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "v|v "
echo " >\ "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "|/v "
echo "/< "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "|X| "
echo " >\ "
echo "${POS}"
tput bel
sleep 1
echo "<o "
echo " \| "
echo "/< "
echo "${POS}"
tput bel
sleep 1
echo "<o> "
echo " | "
echo " >\ "
echo "${POS}"
tput bel
sleep 1
echo " o> "
echo " \ "
echo "/< "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo " x "
echo " >\ "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "</ "
echo "/< "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "<|> "
echo " >\ "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "</> "
echo "/< "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "<\> "
echo " >\ "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "<)> "
echo " >> "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo " |\ "
echo " L "
done 
弄个dropbox空间来备份文件或者做私人代码服务器
配置:[url]git://github.com/roylez/dotfiles.git[/url]
主页:http://roylez.heroku.com
各种稀奇玩意儿:http://dooloo.info
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 两个无聊的脚本

#2

帖子 eexpress » 2008-11-19 12:08

时间的还可以看下。跳舞的算了。
● 鸣学
头像
bones7456
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
联系:

Re: 两个无聊的脚本

#3

帖子 bones7456 » 2008-11-19 12:19

eexpress 写了:时间的还可以看下。跳舞的算了。
赞同一回~
关注我的blog: ε==3
头像
HuntXu
帖子: 5776
注册时间: 2007-09-29 3:09

Re: 两个无聊的脚本

#4

帖子 HuntXu » 2008-11-19 13:40

mark~
HUNT Unfortunately No Talent...
tnfmg
帖子: 9
注册时间: 2008-11-18 18:43

Re: 两个无聊的脚本

#5

帖子 tnfmg » 2008-11-19 20:37

那个dance有创意 :em11
头像
greco
帖子: 2487
注册时间: 2007-04-06 10:24
来自: ~/Shanghai

Re: 两个无聊的脚本

#6

帖子 greco » 2008-11-21 12:28

好玩 :em11 好玩
http://silenceisdefeat.com/~greco

代码: 全选

''.join([chr(ord(c)-2) for c in 'O{"G/ockn"ku<"itgeq0ujkBiockn0eqo'])
echo -n "Z3JlY28uc2hpQGdtYWlsLmNvbQ==" | base64 -d
formylove2
帖子: 105
注册时间: 2008-11-03 10:06

Re: 两个无聊的脚本

#7

帖子 formylove2 » 2008-11-22 3:38

dance 开始SH路径要改
头像
syhan
帖子: 272
注册时间: 2006-09-06 12:24
来自: Southeast University

Re: 两个无聊的脚本

#8

帖子 syhan » 2008-12-04 20:00

见识了tput了,好强大阿
awesome + stalonetrayer + urxvt + rox-filer + feh + SLiM
头像
titainium
帖子: 689
注册时间: 2006-12-02 12:25

Re: 两个无聊的脚本

#9

帖子 titainium » 2008-12-05 13:23

我也回去玩一玩。
我爱跳舞!!!~~~一起来跳舞~~~~~~~ :em05 :em11
Titainium
回复