企业面试题18:老男孩linux企业面试题:
已知下面的字符串是通过RANDOM随机数变量md5sum|cut-c 1-8截取后的结果,请破解这些字符串对应的md5sum前的RANDOM对应数字?
21029299
00205d1c
a3da1677
1f6d12dd
890684b
答案:
[root@nfs_server scripts]# cat pojie.sh
#!/bin/bash
read -t 20 -p “please input a number,you want to pojie:” a
c=1
for n in {0..32767}
do
b=`echo “$n”|md5sum|cut -c 1-8`
if [ $a == $b ]
then
echo “the num you want is :$n”
echo “the num is $c”
exit
else
((c++))
fi
done
原文链接:20道必会shell题目第18,转载请注明来源!