devel@ where you _can_ ask
 help / color / mirror / Atom feed
From: Alexander Lubyagin <lubyagin@yandex.ru>
To: devel-newbies@lists.altlinux.org
Subject: Re: [newbies] Неиспользуемые переменные в Bash и оптимизация
Date: Mon, 1 Dec 2025 17:27:14 +0300
Message-ID: <8ae6322e-878e-4707-a4e4-28e9d8a88642@yandex.ru> (raw)
In-Reply-To: <f2c9a196-9009-4d1b-a5fc-817d228f31b7@yandex.ru>

01.12.2025 17:24, Alexander Lubyagin пишет:
> 01.12.2025 17:14, Alexander Lubyagin пишет:
>> func()
>> {
>>  echo "---" "$1"
>> }
>
> Всё, дошло. v="$(...)" - "забирает" стандартный вывод команд.

Проверил таким кодом:

#!/bin/bash
func()
{
  echo "---" "$1"
  echo "+++" "$1" > /dev/stderr
}
i="abc:123"
echo $i
v="$(func \"bcdef\")|$(func ${i%%:*})"
# echo "$v"
# END

Кстати, хорошая задачка для студентов, на внимательность.

--



  reply	other threads:[~2025-12-01 14:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01 14:14 Alexander Lubyagin
2025-12-01 14:24 ` Alexander Lubyagin
2025-12-01 14:27   ` Alexander Lubyagin [this message]
2025-12-01 15:40 ` Leonid Krivoshein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ae6322e-878e-4707-a4e4-28e9d8a88642@yandex.ru \
    --to=lubyagin@yandex.ru \
    --cc=devel-newbies@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

devel@ where you _can_ ask

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-newbies/0 devel-newbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel-newbies devel-newbies/ http://lore.altlinux.org/devel-newbies \
		devel-newbies@lists.altlinux.org devel-newbies@lists.altlinux.ru devel-newbies@lists.altlinux.com
	public-inbox-index devel-newbies

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-newbies


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git