Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
Hi, answering in few lines is impossible.
check this tutorial for begginers it's excellent
First of all you must have the right OS.
I use CentOS5/6 but in the meantime6 is better.
You can start the code by this:
#!/bin/bash
then you could write the commands the way you wish, Let's write for example a bash script to compress a file then move it from /home/FILE.tar.gz to /backup/FILE.tar.gz
#!/bin/bash
tar -cpzf /home/FILE /home/FILE.tar.gz
mv /home/FILE.tar.gz /backup/
Simple, huh?
BTW, this two commands can be written in one line with a semicolon as a separator.
#!/bin/bash
tar -cpzf /home/FILE /home/FILE.tar.gz; mv /home/FILE.tar.gz /backup/
Also for your knowledge, bash is way too easy than PHP, in PHP you have to end the line by a semicolon but in bash Enter is enough.
FYI, the last two commands can be performed in one command only but I wrote them in this way to just explain my point.
If you need any other examples or any help just let me know
Best wishes.
FYI
bash is a flavor of C-language. if you are good in C-language things are much easier
conditional argument can be done using IF... , IF...THEN or IF---THEN.....ELSE etc
Loops can be done by FOR command
you can run in from the shell by simply typing (assume test.sh is the file name)
# ./test.sh
most of the system coomands of linux work for bash script
cheers
Lijo
use CentOS5/6 but in the meantime6 is better.
You can start the code by this:
#!/bin/bash
then you could write the commands the way you wish, Let's write for example a bash script to compress a file then move it from /home/FILE.tar.gz to /backup/FILE.tar.gz
#!/bin/bash
tar -cpzf /home/FILE /home/FILE.tar.gz
mv /home/FILE.tar.gz /backup/
Simple, huh?
BTW, this two commands can be written in one line with a semicolon as a separator.
#!/bin/bash
tar -cpzf /home/FILE /home/FILE.tar.gz; mv /home/FILE.tar.gz /backup/
Also for your knowledge, bash is way too easy than PHP, in PHP you have to end the line by a semicolon but in bash Enter is enough.
There's a lot of tutorials out there to read on how to bash script.
Select any editor you want to use (e.g. like vim, nano or pico)
Script will start with;
Simple script on how to display directory with colors
#!/bin/bash
echo "Welcome to Bash Shell Scripting!";
ls -FGAl
echo "Display directory with color";
Save it as "display_color.sh"
Convert it as executable
# chmod +x display_color.sh
To execute the script
# ./display_color.sh
This is a simple example of bash shell scripting.
Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?