Вы почти достигли цели:
sed -ne '
/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p # got the range, ok
/-END CERTIFICATE-/q # bailing out soon as the cert end seen
' /etc/nginx/cert.pem
Но обратите внимание, что строки маркеров начала и конца сертификата также являются частью вывода.
Вот кое-что, что будет работать либо в zsh
, либо в bash
, чтобы добиться того, что вам нужно.
Если вы выполните очистку gem clean
, чтобы удалить старую версию tmuxinator
, она исправит ситуацию при следующем запуске кода (т.е. при следующем запуске оболочки, если в ваш .zshrc
)
# Allow shell-specific code
function sh_is_zsh { [[ -n $ZSH_VERSION ]]; }
function sh_is_bash { [[ -n $BASH_VERSION ]]; }
# Update "tmuxinator.{z,ba}sh" if needed
tmuxinator_source="$XDG_CONFIG_HOME/tmuxinator/tmuxinator.$(sh_is_zsh && echo zsh || echo bash)"
# If not a regular file or symlink to one
if [[ ! -f $tmuxinator_source ]]; then
# If doesn't exist or is a symlink to nowhere
if [[ ! -e $tmuxinator_source ]] || [[ -L $tmuxinator_source ]] && [[ ! -e $tmuxinator_source ]]; then
echo "Creating ${tmuxinator_source##*/} symlink:"
tmp=$(gem which tmuxinator) # tmuxinator executable
tmp=$(readlink -f "${tmp%/*}/../completion") # completion scripts dir
ln -fsv "$tmp/${tmuxinator_source##*/}" "$tmuxinator_source"
unset tmp
else
echo "Not creating symlink at at existing:"
ls -lF "$tmuxinator_source"
fi
fi
source "$tmuxinator_source"
unset $tmuxinator_source
Обратите внимание, что это шелл-чек
, очищающий от дополнительных точек домового.