awk -v ln="${line}" 'NR==ln' PhraseList.txt
I'm curious if you need a shell loop around awk - I'm pretty sure you can get away with the purely awk implementation.
Depends on what you're doing inside your loop...
#! /bin/bash -f
# trap Ctl-c so program cannot be broken out of
trap '' 2
#run program
let count=1;
clear;
while true;
do
echo "Don't touch me!";
read -s input;
if [ $input == "thepass" ]
then
clear
echo "Welcome back, master"
exit
else
echo $input "<-----is not going to stop me!!";
sleep 2;
for((i=0;i<2;i++))
do printf "\n";
echo "Hands off!!";
sleep 1;
clear;
sleep 1;
done;
for((x=0;x<50;x++));
do
awk "NR==$count" InsultList; #thank you nezabudka
sleep .025;
done;
clear;
let count=count+1;
fi
done
In general, the use of bash variables in the awk, my version is applicable only to your particular case. Correctly define and use variables in the awk as shown by vgersh99.
Writing your own programs is the right way to improve your skills.