I am writing a shell script which has a bunch of commands, out of which some commands expect user input. For instance, if I want to push my changes to git, I use the command git push
, which then asks me for the username and password. A traditional shell script halts for user input when it expects username. What I want to do is, pass this username and password as a command line argument, and the command should pick up that value.
Please note: 1. The above question is not in context to git, I have just used it as an example. I understand that I can always store my credentials in the configuration file specific to git, and then it won't prompt me for the credentials. I only want to know the technique of how such thing is done.
- Once again, in regards to the example above, security is not a concern. Currently, I am not concerned about passing the password as clear text from command line.
I tried to google it, but didn't get satisfactory results. Any ideas on this will be helpful.