Purchase Solution

Linux: Explain the function

Not what you're looking for?

Ask Custom Question

Using the following script:

#!/bin/bash
#This is a shell script
echo $#
echo $0
echo $1
echo $2
echo $3
echo $*
name1=$1
#name2=$2
echo $name1 "is the first parameter"
echo $name2 "is the second parameter"
echo $
echo $0 "was executed with" $# "parameters on the command line."

Explain the function of each line in the script, assuming that it is executed as follows:

knoppix[knoppix]$ myscript joe mary bob

Purchase this Solution

Solution Summary

The expert uses the Linus operator to explain the function.

Solution Preview

knoppix[knoppix]$ myscript joe mary bob

echo $#
3
This line is to print out the number of arguments. We have 3 of them, joe, mary, bob

echo $0
myscript
This line is to print our the name of the script. So it is myscript.

echo $1
joe
This line is to print out the first argument. So it is joe.

echo $2 ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic Networking Questions

This quiz consists of some basic networking questions.