|
|
ru.linux- RU.LINUX --------------------------------------------------------------------- From : Aleksey Barabanov 2:5020/400 06 Oct 2003 12:34:16 To : Andy Neverowsky Subject : Re: BASH и манипуляции с input -------------------------------------------------------------------------------- Andy Neverowsky wrote: > Есть скрипт на bashe, например, test.sh. > Допустим его нужно использовать в качесве фильтра. > Hапример: > command1 | test.sh > log.txt > test.sh >log.txt <file.txt > echo "Text line" | test.sh > > Как внутри test.sh получить доступ к входному потоку? Хоть три раза: ---------------------cut alekseybb@wsalekseybb:~> cat test.sh #!/bin/sh cat >test.sh.$$.log cat test.sh.$$.log cat test.sh.$$.log cat test.sh.$$.log exit alekseybb@wsalekseybb:~> cat test.sh | ./test.sh #!/bin/sh cat >test.sh.$$.log cat test.sh.$$.log cat test.sh.$$.log cat test.sh.$$.log exit #!/bin/sh cat >test.sh.$$.log cat test.sh.$$.log cat test.sh.$$.log cat test.sh.$$.log exit #!/bin/sh cat >test.sh.$$.log cat test.sh.$$.log cat test.sh.$$.log cat test.sh.$$.log exit alekseybb@wsalekseybb:~> ls -als *.log 4 -rw-r--r-- 1 alekseybb users 92 2003-10-06 12:19 test.sh.3002.log alekseybb@wsalekseybb:~> ---------------------cut Bye. Aleksey Barabanov <alekseybb at mail.ru> -- Отправлено через сервер Форумы@mail.ru - http://talk.mail.ru --- ifmail v.2.15dev5 * Origin: home (2:5020/400) Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.linux/78249be65a95.html, оценка из 5, голосов 10
|