Purchase Solution

Unix/Shell scripting questions

Not what you're looking for?

Ask Custom Question

1. Describe the results of executing each of the following grep commands in your home directory.
a. grep -c ill memo
b. grep -n ill memo

2. What would the permission section of an ls -l listing for filex look like after setting the following permissions?
a. chmod 764 filex
b. chmod 666 filex

3. Rewrite the following sequence of commands using sort as a filter. You should end up with a single command line when you are done.
$ sort roster > temp
$ lpr temp
$ rm temp

4. Write a command, assuming your home directory, to list all files that:
a. Start with the letters b or f.
b. Start with the letters a through k.
c. Have a capital letter anywhere in their name.

5. What is the difference between the following commands?
$ cat xyz[12]
$ cat xyz[1-2]

6. What files would the following match?
$ ls -l file[1-20]

7. Write a script that will prompt for the user's first name and store it in a variable. Then prompt for the last name and store it in a variable. Finally, display the stored information in the format "You entered lastname, firstname" and ask the user for confirmation. If the answer is "y" or "yes" then say "Thank you!" if the answer is "n" or "no" then start again with the prompts.

Purchase this Solution

Solution Summary

Additional example/explanation is given in answer no. 5 and 6 to explain the underlying concept better.

Solution Preview

1a. It gives the count of lines in the file "memo" that have the string "ill" occurring anywhere within them.
1b. It outputs all the lines from the file "memo" that have the string "ill" occurring anywhere within them, and prefixes each line with it's line number in the file ...

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.

Javscript Basics

Quiz on basics of javascript programming language.

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.

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.

C++ Operators

This quiz tests a student's knowledge about C++ operators.