I have a list of commands to backup files, databases or doing some other tasks, I would to run them once
for example
Code:
cd command 1
zip command 2
copy command 3
...
I heard that it is possible by creating a write a bash script but I don't know how to start. Can you guys shoot me a guide?
Many thanks
well if you google learning bash scripts , you will find thousands of tutorials on it. Just go through the tutorials properly.
Interesting question and i do agree with 24x7CSM, i also do a research on Google on how to create a list of commands and run it, tried and it worked.
The first step, you need to have a editor to write content for your file, nano is my first choice.
type:
Ctrl +O and save with name mycommands.sh
if you don't have nano editor on your hosting, run this "yum install nano" to install it
set permission for this file
run it
you also can run this file by these commands
or
in mycommands.sh you add these commands to run your list of commands
Code:
#!/bin/bash
# This is your first script
clear
# put your commands below
cd..
zip...
or some commands here.
echo "Done"
Hope it helps!