#!/usr/bin/env bash
# Reads stdin and writes it to stdout centred.
#
# 1. Send stdin to a temporary file while keeping track of the maximum
# line length that occurs in the input. Tabs are expanded to eight
# spaces.
# 2. When stdin is fully consumed, display the contents of the temporary
# file, padded on the left with the apropriate number of spaces to
# make the whole contents centred.
#
# Usage:
#
# center [-c N] [-t dir] <data
#
# Options:
#
# -c N Assume a window width of N columns.
# Defaults to the value of COLUMNS, or 80 if COLUMNS is not set.
#
# -t dir Use dir for temporary storage.
# Defaults to the value of TMPDIR, or "/tmp" if TMPDIR is not set.
tmpdir="${TMPDIR:-/tmp}"
cols="${COLUMNS:-80}"
while getopts 'c:t:' opt; do
case "$opt" in
c) cols="$OPTARG" ;;
t) tmpdir="$OPTARG" ;;
esac
done
tmpfile="$tmpdir/center-$$.tmp"
trap 'rm -f "$tmpfile"' EXIT
while IFS= read -r line
do
line="${line//$'\t'/ }"
len="${#line}"
maxlen="$(( maxlen < len ? len : maxlen ))"
printf '%s\n' "$line"
done >"$tmpfile"
padlen="$(( maxlen < cols ? (cols - maxlen) / 2 : 0 ))"
padding="$( printf '%*s' "$padlen" "" )"
while IFS= read -r line
do
printf '%s%s\n' "$padding" "$line"
done <"$tmpfile"
Тестирование:
$ fortune | cowsay | ./center
________________________________________
/ "There are two ways of constructing a \
| software design: One way is to make it |
| so simple that there are obviously no |
| deficiencies, and the other way is to |
| make it so complicated that there are |
| no obvious deficiencies." |
| |
\ -- C. A. R. Hoare /
----------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
$ fortune | cowsay -f bunny -W 15 | ./center -c 100
_______________
/ It has just \
| been |
| discovered |
| that research |
| causes cancer |
\ in rats. /
---------------
\
\ \
\ /\
( )
.( o ).
Вы только что ответили на свой вопрос. Если у вас нет подписки, вы не сможете зарегистрироваться. Регистрация требует использования пары имя пользователя / пароль, с которой связана как минимум одна доступная подписка.
Вы должны прикрепить подписки к системе через клиентский портал с помощью Red Hat Subscription Manager, выполнив следующие действия:
Нажмите «Подписки» в левом верхнем углу.
Нажмите «Система» в списке подписчиков в разделе «Управление»
Нажмите «Зарегистрировать систему»
После регистрации нажмите имя системы в Панель «Единицы»
Нажмите «Прикрепить подписку» (написано синими буквами)
Выберите желаемую подписку. tions и нажмите «Прикрепить выбранное»
Даже я столкнулся с той же проблемой. Но проблема решилась. Пока вы не примете условия и положения И у вас не будет активной подписки 1, вы не сможете зарегистрироваться. Я решил эту проблему, добавив название компании как N/A и должность как пенсионер. Через 2 дня после создания учетной записи активная подписка стала 1, и я смог зарегистрировать свою систему.
https://access.redhat.com/products/red-hat-enterprise-linux/evaluation
перейдите по этой ссылке и попробуйте войти на 30-дневную пробную версию
После запуска команды:
subscription-manager list --available
Я получил следующий результат:
Subscription Name: 30 Day Red Hat Enterprise Linux Server Self-Supported
Evaluation
Provides: Red Hat Beta
Oracle Java (for RHEL Server)
Red Hat Enterprise Linux Server
Red Hat CodeReady Linux Builder for x86_64
Red Hat Enterprise Linux for x86_64
Red Hat Ansible Engine
Red Hat Container Images Beta
Red Hat Enterprise Linux Atomic Host Beta
Red Hat Enterprise Linux Atomic Host
Red Hat Container Images