Reality Check (week 3) Solutions: Question #1: #!/bin/bash # ./listing.bash # Author: Murray Saul # e-mail: murray.saul@senecac.on.ca # Date: May 21, 2010 # # Purpose: To demonstrate reality check question ls ~/info/listing.txt > /dev/null 2> /dev/null && echo "File exists" || (mkdir ~/info 2> /dev/null;ls ~ > ~/info/listing.txt; echo "listing has been saved in: ~/info/listing.txt") Question #2: #!/bin/bash # ./listing2.bash # Author: Murray Saul # e-mail: murray.saul@senecac.on.ca # Date: May 21, 2010 # # Purpose: To demonstrate reality check question # Modification of question #1 (use variables) read -p "Please enter a file pathname: " filePathName ls ~/info/$filePathName > /dev/null 2> /dev/null && echo "File exists" || (mkdir ~/info 2> /dev/null;ls ~ > ~/info/$filePathName; echo "listing has been saved in: ~/info/$filePathName")