Preamble: Never created a shell bash script before. So, and first of all, I'm not even sure if this IS the right tool for the job. If it isn't, please, and before all, let me know what, in your opinion, is a best alternative.
Context: I often do repetitive tasks each time I try to setup a web site. I wish to automatize those tasks by running one or two commands. UPDATE: Shared host is Unix based. Local machines are Mac OS X so, also Unix based.
As an example, here are some of the tasks (commands) I often do:
scp ~/local/path/general_web_app/.bash_profile [email protected]:/home/HOSTNAME/.bash_profile scp ~/local/path/general_web_app/.gitconfig [email protected]:/home/HOSTNAME/.gitconfig
ssh [email protected] cd /www/www/ git init git add . git commit -a -m "first commit" cd ~/private/ && mkdir repos
EDIT, FIND, REPLACE SAVE AND EXIT:
pico ~/remote/private/repos/general_hub.git/hooks/post-update replace "user" WITH "hostname"; hit "cmd x" hit "y"
AFAIK: Those are, the different kind of tasks I wish the script to do.
Question 1: Can bash script handle SCP, SSH directly, and EDIT FIND REPLACE SAVE AND EXIT?
Question 2: Some params should be asked to the user who runs the script, and those params, should be used to be placed inside some files (replacing specific keywords there existent) - can this be accomplished?
Question 3: Should we copy the files to the remote and edit directly on the remote, or, should we grab the files locally, "edit them locally on a temp location", and then, place them on the server? I presume the second is much more complicated.
Any examples that I may look at?
Thanks a lot in advance