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

read timing-tests

#!/bin/bash

echo "read und awk:"

time (
    while read ZEILE; do
	    BENUTZERNAME=$(echo $ZEILE | awk -F : '{print $1}')
	    HOMEDIR=$(echo $ZEILE | awk -F : '{print $6}')
	    echo "$BENUTZERNAME -> $HOMEDIR" > /dev/null
    done < /etc/passwd
) 2>&1

echo 
echo "read und cut:"

time (
    while read ZEILE; do
        BENUTZERNAME=$(echo $ZEILE | cut -d : -f 1)
        HOMEDIR=$(echo $ZEILE | cut -d : -f 6)
        echo "$BENUTZERNAME -> $HOMEDIR" > /dev/null
    done < /etc/passwd
) 2>&1

echo 
echo "read und String-Operationen:"
echo

time (
    while read ZEILE; do
        BENUTZERNAME=${ZEILE%%:*}
        TMP=${ZEILE%:*}
        HOMEDIR=${TMP##*:}
        echo "$BENUTZERNAME -> $HOMEDIR" > /dev/null
    done < /etc/passwd
) 2>&1

echo 
echo "read und IFS:"
echo

time (
    while IFS=: read BENUTZERNAME A B C D HOMEDIR E; do
        echo "$BENUTZERNAME -> $HOMEDIR" > /dev/null
    done < /etc/passwd
) 2>&1

Beispiel read und IFS

#!/bin/bash

while IFS=: read BENUTZERNAME A B C D HOMEDIR E; do
    echo "$BENUTZERNAME -> $HOMEDIR"
done < /etc/passwd

codefode

read -p "Enter your name : " name
echo $name

newscript

#!/bin/bash
#This is a special text file
clear
read the_line
There
are 20 students in the class.
[TAB][SPACE] Nearly
half of them are enrolled in FoS. The rest are in
Faculty-Of-ES.
The output from the script should look like
There
[TAB][SPACE] Nearly
Faculty-Of-ES.
while read the_line; do
	((i++%2)) && { echo "$the_line";}
done < "$1"
exit 0

Execute Bash Shell Online

#!/bin/bash
count=`awk '{print NF}' exam2.txt`
min=`awk '{print $1}' exam2.txt`
for((i=1;i<=$count;i++))
n=`awk '{print $'$i'}' exam2.txt`
	if((n< min))
		$min=$n
done
echo "Minimum no. is "$min

#!/bin/bash echo "informe o primeiro número" read n1 echo "informe o segundo número" read n2 echo "informe o terceiro número" read n3 echo "qual o decremento ?" read dec

# Hello World Program in Bash Shell
#!/bin/bash
echo "informe o primeiro número"
read n1
echo "informe o segundo número"
read n2
echo "informe o terceiro número"
read n3
echo "qual o decremento ?"
read dec





emptiness

# Hello World Program in Bash Shell

echo "Hello World!" > hello.txt
cat hello.txt

epr

# Hello World Program in Bash Shell

echo "Hello World!"
echo "cart000 user000 1-1-2010 cycle000 cycle001 cycle003 2-1-2010"

abcd

# Hello World Program in Bash Shell

echo "Hello World!"

date

Advertisements
Loading...

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