Bash Shell Scripting – The Basics and Variables Execution Execute this assignment according to the following guidelines: Complete the UNIX/LINUX Tutorials located in the Topic Materials: Shell Scripting, What is Shell, Using Variables, and Special Variables. Create a bash script that does the following: Create a text file 'compile.sh' in the Text Editor (or Atom or vi editors) Indicate the Shell/Script type in line 1: #!/bin/sh You can print text to console by using: echo "My Text" command. Enter the required commands to compile and run your Hello World C program. Exit your Text Editor (make sure to save your work). Run your script 'compile.sh' from a Terminal session by entering: ./compile.sh What happened? Give the script permission using: chmod 777 test.sh command. Remove the hard code file names and use a bash script argument: Open the 'compile.sh' script in the Text Editor (or Atom or vi editors). Save the program to compile script that is passed as a script argument in a variable ($1 will be your first bash argument). Substitute the variable where you currently have the 'HelloWorld' program name text. Test your script. Add error checking: Open the 'compile.sh' script in the Text Editor (or Atom or vi editors). Check that the script arguments are not empty. Check the return value from gcc. Test your script. Working with environment variables: Create a 'var1.sh' script. Create a variable in var1.sh script. Call the printenv command to print the environment variables out. Call var2.sh from this script. Create a 'var2.sh' script: Call the printenv command to print the environment variables out. Run 'var1.sh' script Modify 'var1.sh' script and prefix the variable with the word export. Run 'var1.sh' script again.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter14: Files And Streams
Section: Chapter Questions
Problem 2E: Create a program named FileComparison that compares two files. First, use a text editor such as...
icon
Related questions
Question
100%

Bash Shell Scripting – The Basics and Variables

Execution

Execute this assignment according to the following guidelines:

  1. Complete the UNIX/LINUX Tutorials located in the Topic Materials:

Shell Scripting, What is Shell, Using Variables, and Special Variables.

  1. Create a bash script that does the following:
    1. Create a text file 'compile.sh' in the Text Editor (or Atom or vi editors)
    2. Indicate the Shell/Script type in line 1: #!/bin/sh
    3. You can print text to console by using: echo "My Text" command.
    4. Enter the required commands to compile and run your Hello World C program.
    5. Exit your Text Editor (make sure to save your work).
    6. Run your script 'compile.sh' from a Terminal session by entering: ./compile.sh
      1. What happened?
    7. Give the script permission using: chmod 777 test.sh command.
  2. Remove the hard code file names and use a bash script argument:
    1. Open the 'compile.sh' script in the Text Editor (or Atom or vi editors).
    2. Save the program to compile script that is passed as a script argument in a variable ($1 will be your first bash argument).
    3. Substitute the variable where you currently have the 'HelloWorld' program name text.
    4. Test your script.
  3. Add error checking:
    1. Open the 'compile.sh' script in the Text Editor (or Atom or vi editors).
    2. Check that the script arguments are not empty.
    3. Check the return value from gcc.
    4. Test your script.
  4. Working with environment variables:
    1. Create a 'var1.sh' script.
    2. Create a variable in var1.sh script.
    3. Call the printenv command to print the environment variables out.
    4. Call var2.sh from this script.
    5. Create a 'var2.sh' script:
      1. Call the printenv command to print the environment variables out.
    6. Run 'var1.sh' script
    7. Modify 'var1.sh' script and prefix the variable with the word export.
    8. Run 'var1.sh' script again.
    9. What differences do you see in the environment for each script?
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,