TIME NOW
World current time now,
CALENDAR
Calendar monthly, yearly
login CONVERT LENGTH
login CONVERT TEMPERATURE
login DICTIONARIES, LISTS
login SCIENCE EDUCATION RELIGION
login WORK CALCULATOR
login CALCULATE LIFE

Linux commands, scripts, examples, tutorial

Previous articlePage bottomNext article  ALL TOPICS

Linux. Loop example - bash sample

 Bash script:

#!/bin/sh

clear

folders='1 2 3 4 5 6 7 8'

echo -e "checker = 1 \ninstall = 2 "

read read

clear ; echo Variable = $read

if [ $read -eq 1 ]
then
    
    > result.txt
    echo Emptying file results.txt ...
    for folder in $folders
    do

    echo $folder
    diff -q  /var_www/programva_com/_man/man$folder /var_www/main/en/_man_pages/man$folder | grep "Only in /var_www/programva_com"  | awk '{ print $4 }' | awk -F'.' '{ print $1 }' | awk -F'_' '{ print $1 }' |  sort | uniq  >> result.txt


    done

elif [ $read -eq 2 ]
    then

    while read file
    do

    echo install $file ; sleep 1
    apt-get install $file-*    
    
    done < result.txt  

fi

sleep 3
 
Previous articlePage topNext article  ALL TOPICS



 Use username: Guest, Anonymous, Programmer






QUOTES:
When we are born we cry that we are come.. to this great stage of fools.
William Shakespeare
It takes two to make a marriage a success and only one to make it a failure.
Herbert Samuel
Death was afraid of him because he had the heart of a lion.
Arabian Proverb