1.Write a script which displeays the amount of times you are logged in to the system (it’s possible to logon more than once).
My answer is:
#!/usr/local/sbin/bash
echo You have logged in `/usr/bin/last |grep $USER |wc -l` times.
十分简单的题目,一开始没有想明白,本来想自己实现计数器,结果忽然想起来last这个命令已经提供了记录了,对数据整形一下就能直接用。