script 3

  1. You may be tempted to put all of this info in a single record in a file
    This is not a good practice. It has duplicate data (namely, the passwords). If you change the password on a device, you do not want to change it in multiple records in this file. This increases the chance of error and your data may lose its integrity.
  2. What if we have a problem when reading files?
    • The user mistypes the nickname and it isn’t in
    • the file
  3. $? Returns a value based on the success of the previous command
    0 means successful


    Another number is not successful (such as 1)
  4. The read command
    can give us a code to check for end-of-file, in case we read to the end of the file
  5. Strategic Goals
    Error checking and options
  6. -eq
    equal to
  7. -ne
    not equal to
  8. -gt
    greater than
  9. -ge
    greater than or equal to
  10. -lt
    less than
  11. -le
    less than or equal to
  12. =
    equal
  13. !=
    not equal
  14. -n
    not empty
  15. -z
    empty
  16. field test operators
    -r
    file exists and is readable
  17. -w
    file exists and it is writable
  18. -s
    file exists and is it nonzero
  19. -f
    file exists and is it not a directory
  20. -d
    file exists and is it a directory
  21. If the filename doesn’t exist,
    prompt the user for the filename until the user enters a valid filename.

    We’ll need a loop.
  22. logical operation
    -a (and)
    both criteria must be met
  23. -o (or)
    either criteria must be met
  24. ! (not)
    if te result was true change to false, if the result was false change it to true
Author
Tjr31
ID
52604
Card Set
script 3
Description
script 3
Updated