Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in unix /linix using cloud9 not sure how to enter all this could some help on how to do it will post instrution below could

in unix /linix using cloud9 not sure how to enter all this could some help on how to do it will post instrution below could enter on scree like would in cloud 9 workspace

LAB 03: Working with text editor (Vi) What you will practice: Working with the command line Vi editor Writing your first shell script Using the Linux Man pages Lab prerequisites: Install vim. To do so, open up a terminal and type: sudo apt-get update sudo apt-get install vim-gnome Description: The vi program is a full-screen text editor that can almost certainly be found on all UNIX systems. vi does not use a large amount of system resources and yet it is very powerful. We are only going touch on vi basics so that you will be able to create and edit files in the coming lessons. There are two modes in vi (three, including last-line mode). The first is input mode. In input mode, text is entered in the document. You can insert or append text. The second mode is command mode. When vi is in command mode, you can move within the document, merge lines, search, cut, and so on. You can do ALL of the functions of vi from command mode except enter new text. Text can only be entered when in text mode. To familiarize yourself with vi (or in this case vim), do the following: Log on to your Linux account and open a terminal. Type in vim showShells.sh. 1. Hit the "i" on your keyboard. You are now in input mode. 2. Please type the following text into the editor. This text is what is known as a shell script. A shell script is a small program that can be executed, in this case, by the Bash shell. Please make sure to break the lines up exactly as they are here. You can type in the text and delete the text using your backspace key. #!/bin/bash echo "You are running `uname -s` version `uname -r`" for x in ash bash bsh csh pdksh ksh sh tcsh zsh; do test -x /bin/$x && shells="$shells $x" done echo "You have at least the following shells installed:$shells" 3. Once you have the above completely typed, hit the ESCAPE key to put yourself in command mode. 4. Move your cursor to the word "at" in the second echo statement. In order to do this, you should use the arrow keys, or the following: "l" moves your cursor right, "h" moves your cursor left, "k" moves your cursor up, and "j" moves down. Practice moving around until you get to the first "at" in this script. 5. Is your cursor placed before the word? Place it after the word by hitting the "w" key. Now, hit the "b" key. Pretty neat, isnt it? Play around for a minute and then bring yourself back to the beginning of the word "at." 6. Now, press "dd". We erased the whole line! Type "u". It is fixed! 7. Make sure you are located right at the word "at" and press "dw". This should delete the word. Press the period key on your keyboard to repeat the previous command. 8. Now, lets save the document. Press the ESC key to bring yourself back to command mode. Then press "ZZ" to save and quit. 9. Enter the following command: chmod u+x showShells.sh 10.Now run your new shell script by entering the following command: ./showShells.sh Questions 1. What does the shell script print out? 2. What do the following do? (Hint: Read the man page) a. chmod b. echo c. test

3. Write a shell script called aboutme.sh that prints your name, rank (freshman, sophomore, junior, senior), and email address on terminal screen. You must begin your shell script with #!/bin/sh or #!/bin/bash for it to work. Submission: You will turn in three files in a tarball: your shell scripts and the answers to the above questions. Type in the questions (number them as above), as well as the answers, in vim. The name of the file that contains your answers should be README. You will turn in a tarball containing the README, showShells.sh, and aboutme.sh files. The following command will create the tarball: $tar -czf 2500_lab1.tar.gz README showShells.sh aboutme.sh Additionally, you will turn in a file containing the log of your session.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2019 Wurzburg Germany September 16 20 2019 Proceedings Part 2 Lnai 11907

Authors: Ulf Brefeld ,Elisa Fromont ,Andreas Hotho ,Arno Knobbe ,Marloes Maathuis ,Celine Robardet

1st Edition

3030461467, 978-3030461461

More Books

Students also viewed these Databases questions

Question

Define lean production.

Answered: 1 week ago

Question

What are the issues of concern for each of the affected parties?

Answered: 1 week ago