Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
usr_bin/random-hostname: Fix a couple of shellcheck warnings
- Ignore SC2034: hostnames appears unused. Verify use (or export if used externally). While at it I rewrote the way how the random hostname is retrieved: First find the line number 3 lines after the line which starts with "# EOF" This is the line where the list of hostnames start. This makes the script a bit more robust and avoids the hard coded start line calculation ("num=$(( $num - 16 ))"). Then list all lines from there by excluding all empty commented out lines and the last line (which start with "'"). Use "sort -R" to randomly sort the list and from there take the last line. That way the confusing "randline" variable calculation is avoided.
- Loading branch information