Save and restore data with command line

command linepassword

I will zip a file with a password. Then, I will write a script and ask:

if (have the password saved) {
   unzip file
} else {
    ask password
    save password
    unzip file
}

I want the user write only one time password in that computer. So what is the best program to save and restore a data. Use a file is too obvious, it will be a little more secure.

Best Answer

My AppleScript-fu isn't up to the task of providing you with the necessary code, but I think you're most likely to find the solution by leveraging the Keychain.