Answer» Hi There-
I am just learning how to do UNIX/Linux work and I have been charged with trying to write a script to automate a couple of processes.
The series of commands is as such.
script 1:
open shell cd /w/config rm mgd_stage ln -s mgd_stage_normal mgd_stage
"perform TPS reset"
--------------------------- script 2:
open shell cd /w/config rm mgd_stage ln -s mgd_stage_horse mgd_stage
perform a "TPS reset"
I know how to do this normally, but would like to be able to just TYPE in a command at the prompt, ie: stage_normal or stage_horse so that the user doens't have to go through all of that work each time...
Anyone out there willing to walk me through this process would be GREATLY appreciated.
Kind Regards,
DECronkJust put all that into a text editor and save it as a .sh file. This is the equivalent of batch files on Windows.Try this: http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.htmlscript 1:
#!/bin/bash cd /w/config rm -r mgd_stage ln -s mgd_stage_normal mgd_stage #tps_reset_command here (I am UNSURE of this command)
--------------------------- script 2:
#!/bin/bash cd /w/config rm -r mgd_stage ln -s mgd_stage_horse mgd_stage #tps_reset_command here (I am unsure of this command)
That should do what you WANT it to. Basically, you put one command on each line, or simply all on one line: #!/bin/bash cd /w/config && rm -r mgd_stage && ln -s mgd_stage_horse mgd_stage && tps_reset_command
Hope that helps
-Stephen
|