Культурный офтопик
 help / color / mirror / Atom feed
From: Michael Shigorin <mike@osdn.org.ua>
To: smoke-room@lists.altlinux.org
Subject: [room] как определить, что stdout перенаправлен
Date: Wed, 19 Mar 2008 20:09:25 +0200
Message-ID: <20080319180925.GC9626@osdn.org.ua> (raw)

	Здравствуйте.
Возможно, ещё кому когда было интересно; тут немного
понадобилось, ну и нагуглил незамеченное ранее в test(1) для
определения того факта, что stdout у скрипта перенаправлен:

jrm@HAL$ if [ -t 1 ]; then echo tty; else echo pipe; fi    
tty
jrm@HAL$ if [ -t 1 ]; then echo tty; else echo pipe; fi|cat
pipe

http://www.freebsdforums.org/forums/showpost.php?p=274074&postcount=9

юзал keywords: shell how to detect output redirection

-- 
 ---- WBR, Michael Shigorin <mike@altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/


             reply	other threads:[~2008-03-19 18:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-19 18:09 Michael Shigorin [this message]
2008-03-19 23:54 ` Aleksey Korotkov
2008-03-19 23:54   ` Michael Pozhidaev
2008-03-20 14:45     ` Aleksey Korotkov
2008-03-20 16:22       ` Michael Shigorin
2008-03-20 18:27         ` [room] что не так с фрёй Michael Shigorin

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=20080319180925.GC9626@osdn.org.ua \
    --to=mike@osdn.org.ua \
    --cc=shigorin@gmail.com \
    --cc=smoke-room@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

Культурный офтопик

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/smoke-room/0 smoke-room/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 smoke-room smoke-room/ http://lore.altlinux.org/smoke-room \
		smoke-room@lists.altlinux.org smoke-room@lists.altlinux.ru smoke-room@lists.altlinux.com smoke-room@altlinux.ru smoke-room@altlinux.org smoke-room@altlinux.com
	public-inbox-index smoke-room

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


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