Changes

Jump to: navigation, search

OPS235 Lab 4 - CentOS7

59 bytes removed, 18:43, 10 April 2015
no edit summary
</code>
<br>
<ol><li value="6">Save your editing session, but remain in the text editor.</li><li>The code displayed below will require uses a trick (called a "flag") to check if the user to include only one argument after the command provided an input file pathname (scriptwhich is absolutely necessary) which will be the application name. The following code will getopt function is also generate used to set variable (and a flag) based on the options that the issuer of the report title and current datecommand used. Add the following code</li></ol>
<br>
<code style="color:#3366CC;font-family:courier;font-size:.9em;">
::if [ outputFlag="n"<br>::while getopts i:n:a:g:o: name::do:: &nbsp;case $# -ne 1 ]name in:: &nbsp;i) inputFile=$OPTARG ;;::then&nbsp;o) outputFile=$OPTARG:: &nbsp; echo outputFlag="Your command must have a application-name as argumenty" >&2;;:: &nbsp; :) echo "USAGEError: $0 [application-name]You need text after options requiring text" >&2:: &nbsp; exit 1::fi<br><br>;;::&#35nbsp; Creates report title (echo with -e option allows newline \n character to be used?)<br><br>::echo -e "\nSOFTWARE PACKAGE INFORMATION REPORTError: Incorrect option" > /root/package-info.txt ::echo -e "Date: $(date +'%A %B %d, %Y (%H&nbsp;exit 1 ;;:%M:%p)')\n\n " >> /root/package-info.txtesac
</code>
<ol><li value="6">Save your editing session, but remain in the text editor.</li><li>The code displayed below uses a trick called the "Here Document" to redirect stdin from within the command (a quick way to display output on the screen). The read command will store the different information report items as words (separated by a space). The sed command used to convert the spaces to pipes (|) and stored into another variable. This allows the sed command to use extended regular expressions to print rpm elements that match those various patterns to be added to the report. Add the following code</li></ol>
13,420
edits

Navigation menu