|
|
|
передать значение в скрипте
|
|||
|---|---|---|---|
|
#18+
ОС SUSE 10. Есть скрипт, запускающий некоторую программу. Программа при запуске задает пользователю вопрос, и ждет на него ответ. Как в этом скрипте передать в эту программу нужный ответ? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 05.10.2007, 17:41:14 |
|
||
|
передать значение в скрипте
|
|||
|---|---|---|---|
|
#18+
$ cat << EOF бла бла бла EOF #обязательно с первой позиции в строке ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 05.10.2007, 18:05:52 |
|
||
|
передать значение в скрипте
|
|||
|---|---|---|---|
|
#18+
если есть запущенная программа prg, которую мне нужно остановить, то интерактивно я делаю следующее: > prg stop на что мне задается вопрос: Are you sure (y/n)? Нажимаю y и Enter. Покажите пожалуйста на примере, как это сделать в скрипте. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 05.10.2007, 18:38:43 |
|
||
|
передать значение в скрипте
|
|||
|---|---|---|---|
|
#18+
man sh read [-p prompt [-t timeout [-er variable ... ] ] ] The prompt is printed if the -p option is specified and the standard input is a terminal. Then a line is read from the standard input. The trailing newline is deleted from the line and the line is split as described in the section on Sx White Space Splitting (Field Splitting) above, and the pieces are assigned to the variables in order. If there are more pieces than variables, the remaining pieces (along with the characters in IFS that separated them) are assigned to the last variable. If there are more variables than pieces, the remaining variables are assigned the null string. Backslashes are treated specially, unless the -r option is specified. If a backslash is followed by a newline, the backslash and the newline will be deleted. If a backslash is followed by any other character, the backslash will be deleted and the following character will be treated as though it were not in IFS even if it is. If the -t option is specified and the timeout elapses before any input is supplied, the read command will return without assigning any values. The timeout value may optionally be followed by one of ``s'' ``m'' or ``h'' to explicitly specify seconds, minutes or hours. If none is supplied, ``s'' is assumed. The -e option exists only for backward compatibility with older scripts. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 05.10.2007, 18:49:48 |
|
||
|
передать значение в скрипте
|
|||
|---|---|---|---|
|
#18+
Ну если не заморачиваться на тему какой вопрос задан то вот Код: plaintext 1. 2. 3. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 05.10.2007, 18:50:44 |
|
||
|
передать значение в скрипте
|
|||
|---|---|---|---|
|
#18+
Сорри, я неправильно понял вопрос. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 05.10.2007, 18:53:24 |
|
||
|
передать значение в скрипте
|
|||
|---|---|---|---|
|
#18+
blinded, спасибо большое, работает! ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 05.10.2007, 19:00:07 |
|
||
|
|

start [/forum/topic.php?fid=25&msg=34850994&tid=1487626]: |
0ms |
get settings: |
6ms |
get forum list: |
8ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
91ms |
get topic data: |
6ms |
get forum data: |
2ms |
get page messages: |
25ms |
get tp. blocked users: |
1ms |
| others: | 216ms |
| total: | 359ms |

| 0 / 0 |
