Думаю, вы ищете man sshd_config
, MaxSessions и MaxStartups поля
http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man5/sshd_config.5?query=sshd_config&sec=5
Файл и путь:
/etc/ssh/sshd_config
#!/bin/bash
# declare the arrays for the files and the sorting
declare -A files
declare -A sorting
# get a list of filenames into it, saving number without 0's as key
for file in *; do
fnum=$(echo "$file" | tr -d -c 0-9 | sed 's/^0*//')
files[$fnum]="$file"
sorting[$fnum]=$fnum
done
# sort the array by its numeric key values
IFS=$'\n' sorted=($(sort -n <<<"${sorting[*]}"))
unset IFS
# check for user input and if its numerical
if [[ $1 =~ ^-?[0-9]+$ ]]; then
# iterate through the array
for i in "${sorted[@]}"; do
# only handle files above user input number
if [[ $i -gt $1 ]]; then
# execute your sql here, echo is just for debugging
echo ${files[$i]}
fi
done
else
echo "Please supply a number as argument"
exit 1
fi
Этот скрипт сохраняет каждый файл в текущем каталоге в ассоциативный массив, используя номер в файле в качестве ключа каждого элемента и соответствующее имя файла в качестве его значения. Обратите внимание, что tr
извлекает ВСЕ числа из имени файла, поэтому 02.test.3.txt
станет 23
. Ведущие нули игнорируются.
Используя ваши файлы в качестве тестов в папке и запуская скрипт как ./test.sh 2
, он выводит это:
03file.txt
022.file.txt
28file.txt