First of all, is this homework?
Originally Posted by LQ rules
Do not post homework assignments verbatim. We're happy to assist if you have specific questions or have hit a stumbling point, however. Let us know what you've already tried and what references you have used (including class notes, books, and searches) and we'll do our best to help. Keep in mind that your instructor might also be an LQ member.
That said, the most direct
way to do this is simply to source
the file into your script, assuming the values are stored as shell-legal "variable=value" pairs.
I hope you realize that having/storing sensitive password information directly in a script or readable text file is a bit of a security risk. However, some systems, such as samba share mounting, already have a "credentials" option that operates pretty much the same way, since it's safer than including them directly in globally available files like fstab.