Question: Part 1: To create a shell script for execution in UNIX system, you need to follow three steps: (1) Create a shell script file with

Part 1:

To create a shell script for execution in UNIX system, you need to follow three steps:

(1) Create a shell script file with an editor (vim,emacs,nona...)

e.g. $vim GetStarted.sh

(2) Type your script in the editor and remember that the first line should declare which kind of shell this script is based on.

e.g. #!/bin/bash

(3) Save the file and change permission type so is can be executable.

e.g. $chmod +x GetStarted.sh

(4) In the current directory, execute the shell script.

e.g. $./GetStarted.sh

Now write a bash script (GetStarted.sh) to accept your first name as an argument and display the success information. The output could be like this.

$./GetStarted.sh Bing Congratulations, Bing! You already known how to get started with shell script.

Part 2:

Here is the definition of Fibonacci numbers (from Wikipedia):

In mathematics, the Fibonacci numbers or Fibonacci series or Fibonacci sequence are the numbers in the following integer sequence:

0, 1, 1, 2, 3, 5, 8, 13 ...

By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two.

In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation

Fn = Fn-1 + Fn-2 with seed values F0 =0,F1 =1.

Write a bash script (fib_lastname.sh) calculating Fibonacci number. It takes one argument n (n >= 0). Do not try numbers greater than 13, which may not work correctly due to number range limitation. The output looks like:

$./fib_li.sh 8 fib 8 = 21

$./fib_li.sh 10 fib 10=55

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!