ITEEDU

10.5. 练习

这里是一些脑力挑战:

  1. 写一个完成如下任务的脚本:

    • 显示执行的脚本的名字。

    • 显示给脚本的第一个,第三个和第十个参数。

    • 显示传递给脚本的参数的总数。

    • If there were more than three positional parameters, use shift to move all the values 3 places to the left.

    • 打印剩下Print all the values of the remaining arguments.

    • 打印参数的个数。

    使用0个,3个,和超过10个参数来测试脚本。

  2. 写一个脚本来实现一个简单的web浏览器(文本模式下),使用 wgetlinks -dump 来向用户显示HTML页面。用户有3个选择:输入一个URL,按 b 返回和 q退出。用户输入的最后10个URL存储在数组之中, entered by the user are stored in an array, from which the user can restore the URL by using the back functionality.