From c7b1fb7e0f027c38fc5789894b0b365cb4cfdd93 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hypki Date: Mon, 15 May 2023 17:38:24 +0200 Subject: [PATCH] Reading input data in the console, not from arguments --- tabledata/ex1.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tabledata/ex1.sh b/tabledata/ex1.sh index 04162d0..2b562c6 100755 --- a/tabledata/ex1.sh +++ b/tabledata/ex1.sh @@ -4,6 +4,14 @@ #numOfPeople=`cat $1 | grep $2 | wc -l` #echo "Num. of people from $2 is $numOfPeople" +echo "Podaj plik z danymi" +read inPlik +echo "Podaj wiek" +read inWiek +echo "Podaj kraj" +read inKraj + + # iterating line-by-line while read line do @@ -15,11 +23,11 @@ country=`echo $line | cut -d " " -f 3` if [ $name != "#" ] then -if [ $country = "$2" -a $age -ge $3 ] +if [ $country = "$inKraj" -a $age -ge $inWiek ] then echo "Person $name (from $country) is $age years old" fi fi -done < $1 +done < $inPlik