atelier

Bash

parcours pratique pour apprendre Bash depuis zero

definition d abord

ce que signifie Bash

Bash sert a ecrire des instructions precises. Ici tu l abordes comme parcours pratique pour apprendre Bash depuis zero. Commence par une idee simple: des entrees passent par des etapes et deviennent une sortie.

infos minimalesfichier script.shexecuter bash script.shhabitude apprends une petite piece de Bash, tape un exemple minimal et execute-le
programme

une suite d instructions executees dans un ordre clair.

valeur et variable

une valeur est une donnee. Une variable est le nom qui la garde.

fonction

un petit travail nomme qui recoit une entree et produit un resultat.

environnement

POSIX shell compatible terminal execute le code de script.sh.

premier code lisible

Commands

pwd ls cd echo
name="Ada"
echo "$name"
sortie Ada

lignee du langage

arbre de Bash

vois d ou vient Bash, quels langages sont proches, et quoi apprendre ensuite.

racines
shUnixawk
actuelBashfamille automatisation et commandes
famillefamille automatisation et commandes
utile pour

utile pour parcours pratique pour apprendre Bash depuis zero

parcours debutant

1lire une regle2prevoir la sortie3taper de memoire4lancer la verification5recommencer avec un changement

Banque de questions

Chercher puis pratiquer

Choisis une etape ou cherche dans la banque de ce langage puis ouvre l exercice.

18 resultats
Q 1ChoixEtape 1 definitions

Bash question 1

Bash question 1. Choisis l explication qui correspond le mieux a echo output.

Q 2ChoixEtape 1 definitions

Bash question 2

Bash question 2. Choisis l explication qui correspond le mieux a variable assignment.

Q 3ChoixEtape 1 definitions

Bash question 3

Bash question 3. Choisis l explication qui correspond le mieux a pipe.

Q 4ChoixEtape 1 definitions

Bash question 4

Bash question 4. Choisis l explication qui correspond le mieux a for loop.

Q 5ChoixEtape 1 definitions

Bash question 5

Bash question 5. Choisis l explication qui correspond le mieux a echo output.

Q 6ChoixEtape 1 definitions

Bash question 6

Bash question 6. Choisis l explication qui correspond le mieux a variable assignment.

Q 7ChoixEtape 1 definitions

Bash question 7

Bash question 7. Choisis l explication qui correspond le mieux a pipe.

Q 8ChoixEtape 1 definitions

Bash question 8

Bash question 8. Choisis l explication qui correspond le mieux a for loop.

Q 9ChoixEtape 1 definitions

Bash question 9

Bash question 9. Choisis l explication qui correspond le mieux a echo output.

Q 10ChoixEtape 1 definitions

Bash question 10

Bash question 10. Choisis l explication qui correspond le mieux a variable assignment.

Q 11ChoixEtape 1 definitions

Bash question 11

Bash question 11. Choisis l explication qui correspond le mieux a pipe.

Q 12ChoixEtape 1 definitions

Bash question 12

Bash question 12. Choisis l explication qui correspond le mieux a for loop.

Q 13ChoixEtape 1 definitions

Bash question 13

Bash question 13. Choisis l explication qui correspond le mieux a echo output.

Q 14ChoixEtape 1 definitions

Bash question 14

Bash question 14. Choisis l explication qui correspond le mieux a variable assignment.

Q 15ChoixEtape 1 definitions

Bash question 15

Bash question 15. Choisis l explication qui correspond le mieux a pipe.

Q 16ChoixEtape 1 definitions

Bash question 16

Bash question 16. Choisis l explication qui correspond le mieux a for loop.

Q 17ChoixEtape 1 definitions

Bash question 17

Bash question 17. Choisis l explication qui correspond le mieux a echo output.

Q 18ChoixEtape 1 definitions

Bash question 18

Bash question 18. Choisis l explication qui correspond le mieux a variable assignment.

choix multiple

Bash question 1

Q 1Choixnouveau

Bash question 1. Choisis l explication qui correspond le mieux a echo output.

echo "$name"

reference

modeles pour script.sh

POSIX shell compatible terminalbash script.sh
rappel de memoirelis un point puis recris le sans regarder
suivre le codenote les valeurs ligne par ligne avant d executer
taper soi memecopie moins tape plus et corrige un petit bug

pwd ls cd echo

Commands

name="Ada"
echo "$name"
  • Quote variables
  • Start with echo
  • Run in a small folder first

grep sort uniq wc

Pipes

printf "a\na\nb\n" | sort | uniq
  • Pipe output to the next command
  • Use rg or grep for search
  • Count with wc

shebang variables if loops

Scripts

for file in *.txt; do
  echo "$file"
done
  • Use set -e for safer scripts
  • Quote paths
  • Dry run before deleting