Explore BrainMass

Explore BrainMass

    Unix/Shell scripting questions

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    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.

    © BrainMass Inc. brainmass.com March 4, 2021, 9:37 pm ad1c9bdddf

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

    Solution Summary

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