Changes

Jump to: navigation, search

OPS235 Lab 1 - CentOS7

1,238 bytes added, 14:39, 31 March 2015
no edit summary
You may have learned about creating and running Bash Shell Scripts in your ULI101 course. Shell scripts help Linux users and system administrators to automatic repetitive tasks to become more efficient and to help them save time. You will be reviewing and building a basic Bash Shell script to generate your newly-installed Linux host machine. Take time to view Shell Scripting Tips on the right-hand side, and run the online tutorial to learn how to create simple shell scripts.
 
# Make certain to log out of your root account and remain as a regular user.
# Open a Shell terminal and use a text editor (such as '''vi''' or '''nano''') to create a Bash Shell script called: '''report.bash''' in your current directory.
# Enter the following text content into your text-editing session:
 
#!/bin/bash # Forces script to run in the bash shell
 
# Author: *** INSERT YOUR NAME ***
# Date: *** CURRENT DATE ***
#
# Purpose: To present sysadmin to create an software inventory
# report containing selected elements
#
# USAGE: ./report.bash
 
 
if [ $USER != "root" ] # checks to see if user is root, and exits script if not
then
echo "You must be logged in as root to run the command." >&2 # >&2 is a "redirection trick" to convert output as stderr
echo "Either login as root or issue command \"sudo ./report1.bash\"" >&2
exit 1
fi
 
 
<ol><li value="4">Save your editing session, assign your report.bash file read and execute permissions (at least for the owner) and run by typing: ./report.bash</li><li>Did it run? If not what do you think you need to do in order to run the Bash Shell Script?</li><li>Issue the command su and run the Bash shell again. Did it work?</li></ol>
13,420
edits

Navigation menu