If you don't know what a command means, don't forget the linux help sheets or the really useful Manual pages directly on the terminal
man <your command>
Execute this commands to create a folder with your name to do some exercices
pwd cd ls cd Documents/ ls -la mkdir <your folder> ls -la cd <your folder> pwd ls
echo "Hello world"
vim ex1.sh
#!/bin/bash echo "Hello world"
chmod +x ex1.sh
./ex1.sh
vim ex2.sh
#!/bin/bash echo "What's your first name ?" read first_name echo "What's your last name ?" read last_name echo "Hello $first_name $last_name! Pleased to meet you :)"
chmod +x ex2.sh
./ex2.sh
vim ex3.sh
#!/bin/bash read -p "What's your first name ? " first_name read -p "What's your last name ? " last_name echo "Hello $first_name $last_name! Pleased to meet you :)"
chmod +x ex3.sh
./ex3.sh
vim ex4.sh
#!/bin/bash echo -e "Hello !\nChoose the maximum number : " read number echo "Display of numbers from 1 to $number" for x in $(seq 1 $number); do echo "$x" done
chmod +x ex4.sh
./ex4.sh
vim ex5.sh
#!/bin/bash echo "Please choose a number between 1 and 10 : " read number if [[ $number -gt 10 ]] || [[ $number -lt 0 ]] then echo -e "\nI said between 1 and 10 !" exit 1 fi echo "Please choose a second number between 10 and 20 : " read second_number if [[ $second_number -gt 20 ]] || [[ $second_number -lt 10 ]] then echo -e "\nI said between 10 and 20 !" exit 1 fi addition=$(($number+$second_number)) echo -e "The addition of the numbers is : $number + $second_number = $addition"
chmod +x ex5.sh
./ex5.sh