Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

caseone

# Hello World Program in Bash Shell

echo "Enter a charater:\c"
read var

case $var in 
[ a-z ]) 
        echo "Its a lower case variable"
        ;;
[ A-Z ]
        echo "Its upper  case"
        ;;
        
?) 
        echo "Special Charater"
        ;;
        
[ 0-9 ]) 
        echo "A number"
        ;;

esac

priya

# Hello World Program in Bash Shell

echo "Hello World!"
cat test.txt

shell script

# Hello World Program in Bash Shell

echo "Enter two numbers seperated by bland=k space between them"
read a b
sum='expr $a + $b'
echo "sum = $sum"

Execute Bash Shell Online

# Hello World Program in Bash Shell

echo "Hello World!" 

86646

echo "Total no of factorial wants"
read fact

ans=1
counter=0
while [ $fact -ne 0 $counter ]
do
        counter=`expr $counter + 1`
        ans=`expr $ans \* $counter`
done
echo "Total of factorial is $ans"

#!/bin/bash UBICACION="/home/server/configuracion/bash/" valor="" contador="0" textoArchivo="" indice=1 #tiempo funcionando la pc en minutos tiempo=$(uptime -p | cut -d "," -f 2 | cut -d "m" -f 1

#!/bin/bash
UBICACION="/home/server/configuracion/bash/"
valor=""
contador="0"
textoArchivo=""
indice=1
#tiempo funcionando la pc en minutos
tiempo=$(uptime -p | cut -d "," -f 2 | cut -d "m" -f 1 | cut -d " " -f 2)
verificarPorListado() {
    while read line2; do
        #verificar si esta activado los dispostivos especificos;
        valor=$(ping -c1 $line2 | grep "packets" | cut -d "," -f 2 | cut -d " " -f 2 | cut -d " " -f 1)
        echo $valor"----"$line2
        if [ "0" != $valor ]; then
            contador=$((contador + 1))
            echo $contador"-------dispositivo activo"
        else
            echo "dispositivo apagado"
        fi
    done <$UBICACION"list-shutdown" 
    #final de buscar dispositivos especificos
}
ejecutarCodigo() {
    sh /home/server/envio-de-email.sh "Apagando" "Apagando Servidor" "[email protected]"
    /sbin/shutdown -h now #comando de apagar
}
verificarPorListado
echo $contador
verificarApagadoAutomatico
if [ "0" != $contador ]; then
    echo "NO apaga"
else
    if [ 10 -lt $tiempo ]; then
        ejecutarCodigo
    else
        echo "cancelado por tiempo"

    fi
fi

test

# Hello World Program in Bash Shell

echo "Hello World!"

Execute Bash Shell Online

#Welcome to slfjknsldf
sdf
s
dfs
d
fs
d

j0joihu

# Hello World Program in Bash Shell

echo "Hello World!"

hello

Z
Z
# Hello World Program in Bash Shell

echo "Hello World!"`
Z
exit
clear

Z

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.