SELECT COMMAND Constructs simple menu from word list. It Allows user to enter a number instead of a word. So User enters sequence number correspondin…
قراءة المزيد#!/bin/bash # for loops echo "all the files in directory--------" for item in * do if [ -f $item ] then echo $item fi done e…
قراءة المزيدBasic Syntax: for VARIABLE in 1 2 3 4 5 .. N do command1 command2 commandN done #OR----------------------------------------------- for VARIABLE in…
قراءة المزيد#!/bin/bash # until loops n=1 # first way echo "----until loops------first way-------------------" until [ $n -gt 10 ] do echo "$n…
قراءة المزيد#!/bin/bash # while loops n=1 while [ $n -le 3 ] do echo "$n" (( n++ )) gnome-terminal & done
قراءة المزيد#!/bin/bash # while loops n=1 # first way echo "----while loops------first way-------------------" while [ $n -le 10 ] do echo "$n…
قراءة المزيد#! /bin/bash os=('ubuntu' 'windows' 'kali') os[6]='mac' unset os[2] echo "${os[@]}" echo "${os[0]}&quo…
قراءة المزيد#! /bin/bash echo -e "Enter some character : \c" read value case $value in [a-z] ) echo "User entered $value a to z" …
قراءة المزيد#! /bin/bash vehicle=$1 case $vehicle in "car" ) echo "Rent of $vehicle is 100 dollar" ;; "van" ) …
قراءة المزيد#! /bin/bash num1=20.5 num2=5 echo "$num1+$num2" | bc echo "$num1-$num2" | bc echo "20.5*5" | bc echo "scale=20;20…
قراءة المزيد#! /bin/bash num1=20 num2=5 echo $(( num1 + num2 )) echo $(( num1 - num2 )) echo $(( num1 * num2 )) echo $(( num1 / num2 )) echo $(( num1 % num2 )) e…
قراءة المزيد#! /bin/bash age=60 # for using OR operator use || if [ "$age" -gt 18] || ["$age" -lt 30 ] then echo "valid age" el…
قراءة المزيد#! /bin/bash age=60 # for using And operator use && if [ "$age" -gt 18] && ["$age" -lt 30 ] then echo "val…
قراءة المزيد#! /bin/bash echo -e "Enter the name of the file : \c" read file_name if [ -f $file_name ] then if [ -w $file_name ] then …
قراءة المزيد#! /bin/bash echo -e "Enter the name of the file : \c" read file_name if [ -s $file_name ] then echo "$file_name not empty" el…
قراءة المزيدBash Shell Conditional Statements Conditionals let us decide whether to perform an action or not, this decision is taken by evaluating an expressi…
قراءة المزيد#! /bin/bash # $* Returns a single string (``$1, $2 ... $n'') # comprising all of the positional parameters # separated by the internal field…
قراءة المزيد#! /bin/bash echo "Enter name : " read name echo "Enterd name : $name" # Multiple inputs echo "Enter names : " read n…
قراءة المزيد#! /bin/bash # this is a comment echo "Hello World" # this is also a comment echo Our shell name is $BASH echo Our shell version name is $B…
قراءة المزيد
Social Plugin