分类目录归档:BSD life…我养魔鬼

荷兰校友的作业-2

a) Write a script IsFilePresent which expects one parameter.
When a file is present in the current directory its output is:”File is present.” Else it’s output is: File is nto present.
Make sure the script gives a useful error if one or two or more parameters are given.
b) change the script from 4.a) so it will accept any number of parameters. (Hint: find information on the shift command).
c) Make the script of assignemnt4 b) interactively. So it will ask for a file name, state the presents of that file and ask if you want to type another filename or not.
If yes it asks for a new file name. Quit when “stop” is given as filename.

继续阅读荷兰校友的作业-2

荷兰校友的作业-1

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这个命令已经提供了记录了,对数据整形一下就能直接用。

怎样删除一个偶数行,但是让偶数行的总数保持不变

假设有一个很多行的文件,忽然发现某个带有特殊标记的偶数行和他的下面的一行是完全一样的。这种事情在一个代码里通常是不被允许出现的。
提问:现在要用某种手段删除这个偶数行,但是要保持某特殊标记在所有偶数行中出现的次数和以前一样,如何实现?:)
这是今天在看FreeBSDrouted的代码的时候发现的问题,已经提交了一个关于这个问题的报告给FreeBSD开发组织。

名气大了就是有人会仿冒

今天在www.freshports.org上面无意中看到了一篇文章,说有人假冒freshports.org要求捐助。具体信息看这里
什么东西都怕出名,这年头假冒名人行骗的事情好像全世界各地都在发生。据说仿冒的那个网站以前是色情网站,后来开始直接打着freshports的旗号四处骗钱。from sweden with love ,这是Martin Gumucio在讨论中给出的标题,哈哈。