update
This commit is contained in:
6
Bash_scripting/1st_script.sh
Executable file
6
Bash_scripting/1st_script.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
WORD="Hello world"
|
||||||
|
echo $WORD
|
||||||
|
echo $USER
|
||||||
|
|
||||||
|
|
||||||
21
Bash_scripting/test.sh
Executable file
21
Bash_scripting/test.sh
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
user=$(whoami)
|
||||||
|
echo "outputul de la comanda whoami este: " $user
|
||||||
|
user="myuser"
|
||||||
|
echo "valoarea variabilei user este acum: " $user
|
||||||
|
|
||||||
|
echo "Ai introdus primul argument: $1"
|
||||||
|
echo "Ai introdus al doilea argument: $2"
|
||||||
|
|
||||||
|
VREME=("ploua" "innorat" "furtuna" "soare")
|
||||||
|
echo "Starea vremii este: $(VREME[0])"
|
||||||
|
echo "Starea vremii este: $(VREME[1])"
|
||||||
|
echo "Starea vremii este: $(VREME[2])"
|
||||||
|
echo "Starea vremii este: $(VREME[3])"
|
||||||
|
|
||||||
|
read nume
|
||||||
|
echo "Numele introus este: $nume"
|
||||||
|
|
||||||
|
read -p "Introdu un nume: " nume
|
||||||
|
echo "Numele introdus este: $nume"
|
||||||
|
echo "Numele introdus este: $(nume:-"Niciun nume introdus")"
|
||||||
20
Bash_scripting/while.sh
Executable file
20
Bash_scripting/while.sh
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
x=1
|
||||||
|
while (( $x < "10" ))
|
||||||
|
do
|
||||||
|
echo "Valoarea lui x este: $x"
|
||||||
|
x=$(( x+1 ))
|
||||||
|
done
|
||||||
|
|
||||||
|
ar=(11 15 86 23 45 78)
|
||||||
|
Lenght=${#ar[@]}
|
||||||
|
echo "Lungimea array-ului este: $lenght"
|
||||||
|
|
||||||
|
ar=(32 10 132 32 5 7 43 104)
|
||||||
|
i=0
|
||||||
|
lenght=${#ar[@]}
|
||||||
|
while [ $i -lt $lenght ];
|
||||||
|
do
|
||||||
|
echo "Elementul $i din array este: ${ar[$i]}"
|
||||||
|
i=$(( i+1))
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user