Патч машинного идентификатора Devuan — решение проблемы или пускание дыма?

Лучший способ запрограммировать эту задачу.

#!/bin/bash

# put number names into array
number_names_arr=(first second third fourth fifth)

# use loop, because code duplication is a bad practice. 
# It repeats five times all commands it have inside.
for ((i = 0; i < 5; i++)); do
    # Prompt line
    echo "Enter ${number_names_arr[i]} number"

    # read inputted number into array
    read -r numbers_arr[i]
done

echo "Output:"
# pass the content of array to the sort command
printf '%s\n' "${numbers_arr[@]}" | sort -rn 
5
04.12.2019, 15:09
0 ответов

Теги

Похожие вопросы