User Tools

Site Tools


assignments:assignment5

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
assignments:assignment5 [2018/08/31 15:49]
david [Question 4]
assignments:assignment5 [2018/08/31 16:02] (current)
david
Line 44: Line 44:
  
 :!: Hint: test your code  :!: Hint: test your code 
 +
 +===== Question 5 =====
 +
 +Scripting with arguments.
 +
 +Write a script that labels arguments 1 - 3, but gives an error message if there is more than three.
 +
 +:!: Hint: I will literally copy your code into the terminal and run it:
 +
 +<code bash>
 +$ bash student_script.sh apples oranges plums
 +Argument 1 is apples
 +Argument 2 is oranges
 +Argument 3 is plums
 +</​code>​
 +
 +But print an error if there are more than 3 arguments.
 +<code bash>
 +$ bash student_script.sh apples oranges plums grapes
 +NO! Too many arguments!
 +</​code>​
 +
 +
 +
 +
 +
  
assignments/assignment5.txt ยท Last modified: 2018/08/31 16:02 by david