From: Oleg <ulug1@mail.ru>
To: sysadmins@lists.altlinux.org
Subject: Re: [Sysadmins] присваивание команды переменной в bash
Date: Fri, 15 Apr 2011 17:39:37 +0400
Message-ID: <4DA84A99.4050008@mail.ru> (raw)
In-Reply-To: <4DA6F8FA.2080001@altlinux.ru>
On 04/14/2011 05:39 PM, Anton Gorlov wrote:
> 14.04.2011 17:32, Oleg пишет:
>> On 04/14/2011 05:23 PM, Anton Gorlov wrote:
>>> Замените `` на ''
>> и как ее потом заставить исполниться в теле скрипта?
>
> ./test.sh
> итого 4
> drwx------ 4 root root 80 Апр 14 08:45 1278716219
> -rwxr-xr-x 1 stalker stalker 35 Апр 14 17:38 test.sh
>
> cat test.sh
> #!/bin/sh
> test="ls -l"
>
> exec $test
Не работает. ls -l работает, как впрочем работает и при объявлении
переменной с `` или поновее $() Так и должно быть.
Причем запускаю в shell (/bin/bash) срабатывает, а в скрипте
(!#/bin/bash) нет
количество параметров? экранирование?
Решил функцией:
errmessage ()
{
/usr/local/bin/sendEmail -f Rbackup@my.domain -t op@my.domain -u "R
backup - ERROR" -o message-charset=UTF-8 -m "ERROR" >/dev/null 2>&1
}
ну и в теле скрипта она она вызывается:
then
errmessage
Все замечательно работает, но хотелось бы понять, на какие грабли
наступил-то? Никто не подскажет?
--
С уважением,
Олег
next prev parent reply other threads:[~2011-04-15 13:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-14 13:23 ` Anton Gorlov
2011-04-14 13:32 ` Oleg
2011-04-14 13:39 ` Anton Gorlov
2011-04-15 13:39 ` Oleg [this message]
2011-04-15 13:59 ` Хихин Руслан
2011-04-15 14:31 ` Oleg
2011-04-15 15:04 ` Хихин Руслан
2011-04-15 16:35 ` Oleg
2011-04-15 17:31 ` Хихин Руслан
2011-04-15 18:03 ` Oleg
2011-04-15 19:02 ` Хихин Руслан
2011-04-15 20:45 ` Sergey Shilov
2011-04-14 13:40 ` Тимур Васюнин
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=4DA84A99.4050008@mail.ru \
--to=ulug1@mail.ru \
--cc=sysadmins@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
ALT Linux sysadmins discussion
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/sysadmins/0 sysadmins/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 sysadmins sysadmins/ http://lore.altlinux.org/sysadmins \
sysadmins@lists.altlinux.org sysadmins@lists.altlinux.ru sysadmins@lists.altlinux.com
public-inbox-index sysadmins
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.sysadmins
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git