How to write a shell script?
I'd like to know how to create a script that I can execute from the command line that would encapsulate all these individual commands. It should:
1. Be able to accept a number of parameters (e.g. siteurl, dbname, etc…)
2. I need to be able to use those paramters as variables in the script (e.g. mkdir /srv/www/{siteurl}/public_html)
3. Where should such scripts be located? What permissions should I set on them? What are the naming conventions?
I imagine its fairly trivial to put something like this together, I just want to make sure I do it right and following whatever conventions there are for these kind of things.
2 Replies
say addwordpresssite, then you would need to type addw[tab] blah
the rest you'll need to find a scripting tut, it's a lot of fun.
intro to the command lineAdvanced Bash Scripting Guidepositional parameters