From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 601 invoked from network); 7 Jan 2023 13:32:38 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 7 Jan 2023 13:32:38 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1673098358; b=bnDSeC/Kqk9jxbeeBbpk3v5hNC3aExBHU1F2EMJSlEguPXqsjDUo92yJm1c4JnVCNdo8yeI1th MNrAISQdL9iZyr6uoBheLY33PaOOdVt/QKJ0Rb6Nw9Uy2vQewtQ6l0r/sfmwwdvSc2f6R4i3e8 oH1Yr4V0VKIP1+9/MAijUcTFK0ufDDq7TQ8y8DGomRnhzNHfF0cLNMibN/6cVQcPFSXx4WVv4C vGt3HgxYOL1+SAKoxvQkmL5IXdZ/aeGGfvk06YZA8jGJKA8LqlKlUCiMEXg/sKDqnvw+pk3vhx Yy1pjKf4lYiZ6JY0CUkI3UniLQOfkTANgNLonCLmt9PVGA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f45.google.com) smtp.remote-ip=209.85.218.45; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1673098358; bh=Iz5wK62F1gTKyEU6gTVL+asTd0faB7J+g7mUFIqU+iA=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=qsFW8UmbmbdvonEFsYX3KBsVPr3IJ7HtgkpBv0+NLdKgipEIqfPZ89MA5S903m/dqWA99a2ZAx SJsMeYHff80w/Q3tF482+Xq/24/UzW+7qKTSr9dEuxvm59CH40tbW9J+rAIimWhq5vDUoRhmZ2 r7BSpn0PVBxU2hiYt6Gnze71h/Y8fXVMlE+lNOvmLRA8btSAvAeGgmG8XhNY/LRwRdD1odUkVV c8txN3zaD6KgpVI0ICGPBlzbGyAXYkDQm66rps0nQ2lLxlMZyRKUUkSSNAtKg7tspyaI86Rpep WTOADBaj8HuBRBUVyOjtqHtuID+ywoXD+vLC1rxmGxIt5A==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=Iz5wK62F1gTKyEU6gTVL+asTd0faB7J+g7mUFIqU+iA=; b=AUMeE5dAMm7SFbZw7ikRPX/s0z 4cbnXt0wCM5bCacY79izOViAeF25vNCeETNxIM+q5FuWQA3i5kTgUV/eDmrTGHiECxuoqEmYf0Dms qLiQ/D/gpQDnXk4qTOKuWqshHwYrQcmPvwIp+jd5nIvLFXUGs4KlLe5DcBcntjHclUyc5gesyvhWo BJsebVACQBeLv1ECN2aLXXuPX674IJD/MfFkVOn2Nd7GWyBfaqOfCTLhghjBJ3Rq5Rpt1Yy9R3VvY kEEHlDdJqEoJsXFG5JSDr80mc6e6btFMFTCcIUhtu0ea3usi9puEVdayNGAfj4NKR8pZYTsotXzyT lKOcM51Q==; Received: by zero.zsh.org with local id 1pE9JN-0005Rg-VI; Sat, 07 Jan 2023 13:32:37 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f45.google.com) smtp.remote-ip=209.85.218.45; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ej1-f45.google.com ([209.85.218.45]:45011) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pE9Id-0004mP-7z; Sat, 07 Jan 2023 13:31:51 +0000 Received: by mail-ej1-f45.google.com with SMTP id ss4so2085930ejb.11 for ; Sat, 07 Jan 2023 05:31:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=Iz5wK62F1gTKyEU6gTVL+asTd0faB7J+g7mUFIqU+iA=; b=bJsukka9mSNi13KqcLqCFNMLW96T1yQtz5dTraKyUf+Eai6g9WAlWBRy0qIm8Y6hXP st6sH9jOl4JNz1iYn297/djulg0SFGFF+bpPdn6vSG7J9xvcH0v9cJ3Nkblc0SPXo2qq PdZTN9eud/SGfrcAJ+znOhtf9J8sE+poXnetYlryP0IWCBJXkmdC+u+HvXbGmgs04Gj2 ZCKQhtGtSjFypf9WSu2zDt0dL1zrAz7Z5g/SfrCPyXEqrjBnbdqwI+Sy5ed9diFMf8bi pr5KtoO/uvp2e4GSYeVtWQR4eytLjtLHzrvBF2c4ygVtuxC3y3LZUQTYMBsVb+yrG3I1 +V9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Iz5wK62F1gTKyEU6gTVL+asTd0faB7J+g7mUFIqU+iA=; b=3lPVYlM+whDtAN3UUgPMJUj6r0L35f30h4ZgvcpH6S3TzBS4ldKCzgI/0QGFTK2UJW 92NAq8ME5brn7uF9l3osbYf49GWEYsOV+kK1dKcxl1zIGy60v0Zj+wHDod70IAW5fM/Z TKwSntX+byHSK6dXLNfPWT+EGH64oxG9B43wtv4rDY1Nj280KuQjguVX7U+XnmzU5A7z eDkZC8W7Ow1VGZ/9TXn2iKAlhTxTTnKufhIsv+aQPFAQSqOakjkQdoPmFqBwNAXU8EPz DBY4h7U4dFSWapB2z+3g/P6AJgwBLQSF414uNPEsTrPbMW3ThR692Zpjk0adXkZ0pEV2 Rq2Q== X-Gm-Message-State: AFqh2krNDjr8mh/oUw1q6DFy34383WQsb3fguRwQN775Z+/5on0wkn4c mIQ/k94VnhiazBQOydFubKvY1pcdtRtSbQiWxOdcrXbCtvhHKA== X-Google-Smtp-Source: AMrXdXvsoaw9vmWOFNdWiyAgly+lnwFYfEU0za0rvnL2mdXGbjKE7ZT6YXdfjV+VtBN6Xm/1z5ttwZqoi0tV5EHTcY0= X-Received: by 2002:a17:906:4ed5:b0:7c1:44e6:8c40 with SMTP id i21-20020a1709064ed500b007c144e68c40mr3128992ejv.646.1673098310322; Sat, 07 Jan 2023 05:31:50 -0800 (PST) MIME-Version: 1.0 From: Pier Paolo Grassi Date: Sat, 7 Jan 2023 14:31:14 +0100 Message-ID: Subject: read with redirected stdin To: Zsh-Users List Content-Type: multipart/alternative; boundary="00000000000076108705f1ac8e2f" X-Seq: 28617 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: --00000000000076108705f1ac8e2f Content-Type: text/plain; charset="UTF-8" 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 --00000000000076108705f1ac8e2f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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<= /div>
in the script.
To be able to ask the user for confirm e= ven when the script stdin is connected to a pipe I did
read -k1 &= lt; /dev/tty
I now would like to be able to deactivate this behav= ior when the process has no controlling terminal, eg when run from cron. To= simulate this I tried:

setsid zsh -c 're= ad -k1 < /dev/tty'

which gives:
z= sh:1: no such device or address: /dev/tty

how = can I prevent this error, so that I don't invoke read when there is=C2= =A0no controlling terminal for the current process?
thanks
<= div>
Pier Paolo Grassi
<= /div>
--00000000000076108705f1ac8e2f--