Exercises

10.5. Exercises

Here are some brain crackers:

  1. Write a script that does the following:

    • Display the name of the script being executed.

    • Display the first, third and tenth argument given to the script.

    • Display the total number of arguments passed to the script.

    • 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.

    • Print the number of arguments.

    Test with zero, one, three and over ten arguments.

  2. Write a script that implements a simple web browser (in text mode), using wget and links -dump to display HTML pages to the user. The user has 3 choices: enter a URL, enter b for back and q to quit. The last 10 URLs entered by the user are stored in an array, from which the user can restore the URL by using the back functionality.


88 visits (3 today, 3 this week, 34 this month, 88 this year)
Uptime: 19:05:24 up 1 day, 34 min, 51 users, load average: 22.51, 22.42, 21.87
216.73.216.58 GET from server z.larrymurakami.com

Monday, November 30, 2026 @ 7:05:24 PM
z.ServerAdmin@lamurakami.com