diff --git a/unix/25-1/1/Screenshot_20250915_123817.png b/unix/25-1/1/Screenshot_20250915_123817.png new file mode 100644 index 0000000..c0e5ca4 Binary files /dev/null and b/unix/25-1/1/Screenshot_20250915_123817.png differ diff --git a/unix/25-1/1/Screenshot_20250915_124152.png b/unix/25-1/1/Screenshot_20250915_124152.png new file mode 100644 index 0000000..a065da5 Binary files /dev/null and b/unix/25-1/1/Screenshot_20250915_124152.png differ diff --git a/unix/25-1/1/Screenshot_20250915_141630.png b/unix/25-1/1/Screenshot_20250915_141630.png new file mode 100644 index 0000000..33a0d05 Binary files /dev/null and b/unix/25-1/1/Screenshot_20250915_141630.png differ diff --git a/unix/25-1/1/Screenshot_20250915_142218.png b/unix/25-1/1/Screenshot_20250915_142218.png new file mode 100644 index 0000000..1bf25ee Binary files /dev/null and b/unix/25-1/1/Screenshot_20250915_142218.png differ diff --git a/unix/25-1/1/Screenshot_20250915_144642.png b/unix/25-1/1/Screenshot_20250915_144642.png new file mode 100644 index 0000000..e3fee1f Binary files /dev/null and b/unix/25-1/1/Screenshot_20250915_144642.png differ diff --git a/unix/25-1/2/Screenshot_20251016_103736.png b/unix/25-1/2/Screenshot_20251016_103736.png new file mode 100644 index 0000000..db2ada3 Binary files /dev/null and b/unix/25-1/2/Screenshot_20251016_103736.png differ diff --git a/unix/25-1/2/Screenshot_20251016_113218.png b/unix/25-1/2/Screenshot_20251016_113218.png new file mode 100644 index 0000000..b35a167 Binary files /dev/null and b/unix/25-1/2/Screenshot_20251016_113218.png differ diff --git a/unix/25-1/3/Screenshot_20251030_113936.png b/unix/25-1/3/Screenshot_20251030_113936.png new file mode 100644 index 0000000..a8d1f50 Binary files /dev/null and b/unix/25-1/3/Screenshot_20251030_113936.png differ diff --git a/unix/25-1/3/Screenshot_20251030_114932.png b/unix/25-1/3/Screenshot_20251030_114932.png new file mode 100644 index 0000000..fab5c99 Binary files /dev/null and b/unix/25-1/3/Screenshot_20251030_114932.png differ diff --git a/unix/25-1/3/Screenshot_20251105_150721.png b/unix/25-1/3/Screenshot_20251105_150721.png new file mode 100644 index 0000000..7d4697d Binary files /dev/null and b/unix/25-1/3/Screenshot_20251105_150721.png differ diff --git a/unix/25-1/4/Screenshot_20251105_154701.png b/unix/25-1/4/Screenshot_20251105_154701.png new file mode 100644 index 0000000..46736f2 Binary files /dev/null and b/unix/25-1/4/Screenshot_20251105_154701.png differ diff --git a/unix/25-1/4/Screenshot_20251113_105927.png b/unix/25-1/4/Screenshot_20251113_105927.png new file mode 100644 index 0000000..c1581b0 Binary files /dev/null and b/unix/25-1/4/Screenshot_20251113_105927.png differ diff --git a/unix/25-1/4/Screenshot_20251113_111128.png b/unix/25-1/4/Screenshot_20251113_111128.png new file mode 100644 index 0000000..b844c69 Binary files /dev/null and b/unix/25-1/4/Screenshot_20251113_111128.png differ diff --git a/unix/25-1/4/Screenshot_20251113_111834.png b/unix/25-1/4/Screenshot_20251113_111834.png new file mode 100644 index 0000000..4583b63 Binary files /dev/null and b/unix/25-1/4/Screenshot_20251113_111834.png differ diff --git a/unix/25-1/4/Screenshot_20251113_112030.png b/unix/25-1/4/Screenshot_20251113_112030.png new file mode 100644 index 0000000..b337bc4 Binary files /dev/null and b/unix/25-1/4/Screenshot_20251113_112030.png differ diff --git a/unix/25-1/4/Screenshot_20251113_113425.png b/unix/25-1/4/Screenshot_20251113_113425.png new file mode 100644 index 0000000..af54a4d Binary files /dev/null and b/unix/25-1/4/Screenshot_20251113_113425.png differ diff --git a/unix/25-1/4/Screenshot_20251113_114446.png b/unix/25-1/4/Screenshot_20251113_114446.png new file mode 100644 index 0000000..abf739c Binary files /dev/null and b/unix/25-1/4/Screenshot_20251113_114446.png differ diff --git a/unix/25-1/4/Screenshot_20251113_114523.png b/unix/25-1/4/Screenshot_20251113_114523.png new file mode 100644 index 0000000..02fb2db Binary files /dev/null and b/unix/25-1/4/Screenshot_20251113_114523.png differ diff --git a/unix/25-1/5/README.md b/unix/25-1/5/README.md new file mode 100644 index 0000000..5a43ef2 --- /dev/null +++ b/unix/25-1/5/README.md @@ -0,0 +1,14 @@ +Вариант 109 +Написать 2 shell-процедуры +Первая процедура: +при первом получении сигнала выдает на терминал сообщение «Доброе +утро»; +при втором получении сигнала выдает на терминал сообщение «Добрый +день»; +при третьем получении сигнала выдает на терминал сообщение «Добрый +вечер»; +при получении сигнала запускает n раз (n передается в процедуру в качестве +параметра) в фоновом режиме процедуру 2 и на этом завершает свою работу. +Вторая процедура: +создает в текущем каталоге подкаталог С, делает его текущим и на этом завершает +свою работу. diff --git a/unix/25-1/5/main.sh b/unix/25-1/5/main.sh new file mode 100755 index 0000000..caa66ef --- /dev/null +++ b/unix/25-1/5/main.sh @@ -0,0 +1,62 @@ +#!/bin/env bash + +set -exu + +if [ "$#" -ne 1 ]; then + echo "Неверное число аргументов" >&2 + exit 1 +fi + +COUNT=0 +N=$1 + +int_handler() { + case $COUNT in + 0) + echo "Доброе утро" + ;; + 1) + echo "Добрый день" + ;; + 2) + echo "Добрый вечер" + ;; + esac + COUNT=$(((COUNT + 1) % 3)) + return 0 +} + +chdir() { + mkdir -p "C" + if [ ! -d "C" ]; then + echo "Не удалось создать каталог ${PWD}/C" >&2 + return 1 + fi + + cd "C" || { + echo "Не удалось перейти в каталог ${PWD}/C" >&2 + return 1 + } + + return 0 +} + +quit_handler() { + for ((i=0; i<$N; i++)) do + chdir + + if [ "$?" -ne 0 ]; then + echo "Обработка сигнала QUIT не удалась" + return 1 + fi + done + + exit 1 +} + +trap int_handler INT +trap quit_handler QUIT + +while true; do + read -t 1 || true +done