Question

In: Computer Science

For this part of the assignment I want you to execute the script CS50_hw_session04b. This will...

For this part of the assignment I want you to execute the script CS50_hw_session04b. This will create a directory called hw_session04 in your home directory. Change directories to hw_session04.

- Execute file_1 in hw_session04

- Read file_2 in hw_session04

- Create the file dir_3/name with the output of the whoami command and the first secret code when you execute file_1. Save the output of executing file_1 exactly as shown. There should be two lines in dir_3/name.

- Create the file dir_3/now with the output of the date command and the second secret code when you read file_2. Save the output of reading file_2 exactly as shown. There should be two lines in dir_3/now.
- Create a file called jamesbond in hw_session04 with the output of the date command. Change the permissions of the file jamesbond so that user has no access, group has no access but other has full access.

- Create a file called myfriend in hw_session04 with the output of the date command. Change the permissions of the file myfriend so that user has full access, group has read and execute access and other has no access.

- Execute the following commands and add the output to a file call session04b_hw

--- Echo your first and last name as the first line of the file session04b_hw
--- Get a long listing of the files in hw_session04
--- Display the contents of the file dir_3/name
--- Display the contents of the file dir_3/now
--- Echo the following message "The permissions of jamesbond is XXX". When you echo this message replace the XXX with the numeric permission value for the file jamesbond before echoing out the message.

Once you have executed the above commands, look over the file session04b_hw and check that it looks like you would expect based on the commands you have executed.

Solutions

Expert Solution

*. To execute the script CS50_hw_session04b . give it executable permission by typing
            chmod +x CS50_hw_session04b
    then you can execute it by typing
            ./CS50_hw_session04b

    or you can execute the sript
            sh CS50_hw_session04b

                                       or

            bash CS50_hw_session04b

Now change directory into CS50_hw_session04 which is in the home directory

           cd ~/CS50_hw_session04

type command  

          ls

to see the files in the directory. you can see file_1 and file_2

- to execute file_1 type
          bash file_1

- to read the file_2 you can use commands 'cat' or 'less'

        cat file_2

           or

        less file_2

- to create dir_3 ,type

      mkdir dir_3
  
      for the rest of the task type

       whoami >dir_3/name
       bash file_1 >>dir_3/name
- type command
      date > dir_3/now

      cat file_2 >>dir_3/now

- type commands
      date > jamesbond
      chmod 007 jamesbond
- type commands
      date > myfriend
      chmod 750

- type theses commands
     --
          echo "first name" >session_04b_hw
     --
          ls -l

     --
          cat dir_3/name
     --
          cat dir_3/now
     --
         echo "The permission of jamesbond is $(stat -c "%a" jamesbond) " >> session_04b_hw

     


Related Solutions

For this assignment I want you to assume you are the President of the United States,...
For this assignment I want you to assume you are the President of the United States, and China (one of our largest export customers) decides to ban all imports from the U.S. What effect would that have on the U.S. economy? Consider AD, unemployment, inflation, and recession as you contemplate your answer. Once you have determined a potential danger to our economy, what fiscal policy tool would you use to mitigate the damage of China’s decision?
Assignment Direction: Complete Part I of this assignment first, if you have not done so, because...
Assignment Direction: Complete Part I of this assignment first, if you have not done so, because it provides guided practice on questions similar to the questions in Part II here. Check out the “Important Resources and Assignment Guides” in the Modules section on Canvas to see how to properly show your math work. There are also examples of the APA-style tables and graphs (figures) for your reference. Your submitted assignment must be in Word format, with a clear answer typed...
For this assignment, I want you to evaluate at least three categories of data that could...
For this assignment, I want you to evaluate at least three categories of data that could be found in a healthcare organization and to determine the relative value of that data to an outside attacker. Categories of information could include health history, scheduled procedures, lab test results, medication record, payer information (e.g. Insurance, Medicaid, Medicare info), personal information (including birthdate, address, ssn), or others. Indicate the following for each of the three categories you choose: 1. Type(s) of harm that...
Red Yoder: Script for Introductory Monologue I understand you want to hear my story; well I’m...
Red Yoder: Script for Introductory Monologue I understand you want to hear my story; well I’m not much for talking, but I can give you the highlights. There’s a lot that’s happened over my 80 years. From the top. My name is Sherman Yoder, but I answer to “Red.” No one around here even remembers my real name. I was born in this house in the downstairs bedroom. Mom had already delivered six kids and there was no way I...
Red Yoder Introductory Monologue Script I understand you want to hear my story; well I’m not...
Red Yoder Introductory Monologue Script I understand you want to hear my story; well I’m not much for talking, but I can give you the highlights. There’s a lot that’s happened over my 80 years. From the top. My name is Sherman Yoder, but I answer to “Red.” No one around here even remembers my real name. I was born in this house in the downstairs bedroom. Mom had already delivered six kids and there was no way I was...
For this extra credit assignment, I want you to do a websearch! Hominin fossils are being...
For this extra credit assignment, I want you to do a websearch! Hominin fossils are being discovered in areas that are newly being investigated! (by the way…when I took this class-there were only a handful of these creatures---aren’t you lucky that they are being discovered now?!?). What I want you to do is choose one of the hominins below and answer the questions-very similar to your cave art exercise. Choose from:    Australopithecus sediba                               Homo luzonensis                               Homo Naledi...
Artificial Intelligence Opinion Paper For this assignment I want you to write an opinion paper on...
Artificial Intelligence Opinion Paper For this assignment I want you to write an opinion paper on whether you believe AI - artificial intelligence, is ever going to become as sophisticated as the human mind. In your paper you should cite 2-3 sources (websites, research articles, etc) that help support your thought process. The paper should be 2-3 pages long, 12-point font, double spaced.
I need this in java A6 – Shipping Calculator Assignment Introduction In this part, you will...
I need this in java A6 – Shipping Calculator Assignment Introduction In this part, you will solve a problem described in English. Although you may discuss ideas with your classmates, etc., everyone must write and submit their own version of the program. Do NOT use anyone else’s code, as this will result in a zero for you and the other person! Shipping Calculator Speedy Shipping Company will ship your package based on the weight and how far you are sending...
For this assignment, you will use the provided database in the Unit 5 script file. You...
For this assignment, you will use the provided database in the Unit 5 script file. You will add statements to this file to query the database tables. For your reference, below is a screenshot of the enhanced entity relationship diagram (ERD) as a reference when you write your queries. With the data types listed in the diagram, this will help you identify the types of operators that you can use for particular queries. Use paiza.io for MySQL to execute and...
Write a Matlab script-file probl1.m to execute the requested commands (as much as possible) in the...
Write a Matlab script-file probl1.m to execute the requested commands (as much as possible) in the exercises below. Increase N a number of times according to N = 4, 8, 16, 32, 64, 128, . . . (1) Determine for each N the (exact) error. (2) Determine for N ≥ 16 also the convergence ratio q(h/2). This script should be based on a function-file trap.m (trapezoidal integration) as follows: function [totarea] = trap(N) format long; a = 0; b =...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT