Open main menu

CDOT Wiki β

Changes

OPS235 Lab 1 - CentOS7

871 bytes added, 14:54, 31 March 2015
no edit summary
</pre>
<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><li>Reopen your text-editing session for report.bash and add the following lines of code to the bottom of the shell script file:</ol> <pre style="font-family:courier;font-weight:bold;padding-left:4px;margin-left:15px;"># Create report title echo "SOFTWARE ASSET REPORT FOR INSTALLED LINUX SYSTEM" > /root/report.txtecho "Date: $(date +'%A %B %d, %Y (%H:%M:%p)')" >> /root/report.txtecho >> /root/report.txt </pre> <ol><li>Save and run the bash shell script. View the contents of the file called "report.txt" that was generated.</li><li>The only remaining content of the report would be the system information. We can use a shell scripting trick called "command substitution" $( .. ) in order place results from an command to be used by another command (like echo). Re-edit the shell script and add the following code at the bottom of the shell script file:</li></ol>  
13,420
edits