show line number if bad skylink is found

This commit is contained in:
Karol Wypchlo 2020-11-24 15:14:22 +01:00
parent fd404fa2ea
commit 5a203a9583
1 changed files with 3 additions and 1 deletions

View File

@ -14,13 +14,15 @@ skylinks=()
if test -f "$1"; then if test -f "$1"; then
OLDIFS=$IFS OLDIFS=$IFS
IFS=',' IFS=','
line_number=1
while read line while read line
do do
if [[ $line =~ ([a-zA-Z0-9_-]{46}) ]]; then if [[ $line =~ ([a-zA-Z0-9_-]{46}) ]]; then
skylinks+=("$BASH_REMATCH") skylinks+=("$BASH_REMATCH")
else else
echo "Incorrect skylink: $line" && exit 1 echo "Incorrect skylink at line ${line_number}: $line" && exit 1
fi fi
let line_number+=1
done < $1; done < $1;
IFS=$OLDIFS IFS=$OLDIFS
else else