zsh-users
 help / color / mirror / code / Atom feed
* read with redirected stdin
@ 2023-01-07 13:31 Pier Paolo Grassi
  2023-01-07 13:44 ` Roman Perepelitsa
  0 siblings, 1 reply; 21+ messages in thread
From: Pier Paolo Grassi @ 2023-01-07 13:31 UTC (permalink / raw)
  To: Zsh-Users List

[-- Attachment #1: Type: text/plain, Size: 638 bytes --]

Hello, I have a script that asks to create a target dir if it doesn't exist.
to that extend I inserted an
read -k1
in the script.
To be able to ask the user for confirm even when the script stdin is
connected to a pipe I did
read -k1 < /dev/tty
I now would like to be able to deactivate this behavior when the process
has no controlling terminal, eg when run from cron. To simulate this I
tried:

setsid zsh -c 'read -k1 < /dev/tty'

which gives:
zsh:1: no such device or address: /dev/tty

how can I prevent this error, so that I don't invoke read when there is no
controlling terminal for the current process?
thanks

Pier Paolo Grassi

[-- Attachment #2: Type: text/html, Size: 1052 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2023-01-10  6:05 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-07 13:31 read with redirected stdin Pier Paolo Grassi
2023-01-07 13:44 ` Roman Perepelitsa
2023-01-07 17:21   ` Pier Paolo Grassi
2023-01-07 17:31     ` Roman Perepelitsa
2023-01-07 17:36       ` Pier Paolo Grassi
2023-01-07 17:52         ` Roman Perepelitsa
2023-01-08 13:23       ` Daniel Shahaf
2023-01-08 13:48         ` Roman Perepelitsa
2023-01-08 14:21           ` Daniel Shahaf
2023-01-08 14:42             ` Roman Perepelitsa
2023-01-07 17:33     ` Pier Paolo Grassi
2023-01-08  4:28     ` Jim
2023-01-08  4:44       ` Pier Paolo Grassi
2023-01-08 21:18         ` Jim
2023-01-09 16:01           ` Pier Paolo Grassi
2023-01-09 22:47             ` Jim
2023-01-10  2:46               ` Bart Schaefer
2023-01-10  6:03                 ` Pier Paolo Grassi
2023-01-08 14:44       ` Ray Andrews
2023-01-08 15:06         ` Roman Perepelitsa
2023-01-08 20:23           ` Ray Andrews

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).