#278·leetcode

TenthLine - bash

Author: hinellCreated Aug 30, 2022Updated Aug 30, 2022

Well I think the example given in the TenthLine.sh is a pure cheating. Here a few good examples for faster bash solution:

bash
declare i=1;
while read line;
do ((++i)); [[ i -eq 11 ]] && echo $line;
done < file.txt

or

bash
IFS=$'\n' readarray arr < file.txt; echo ${arr[9]}