help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] How to redirect tty to /dev/null?


From: Stephane Chazelas
Subject: Re: [Help-bash] How to redirect tty to /dev/null?
Date: Tue, 3 Sep 2019 18:48:59 +0100
User-agent: NeoMutt/20171215

2019-09-03 10:40:17 -0500, Peng Yu:
> If I run the following command, it still asks the password in the
> screen. I suspect that somehow the pass is taken from tty instead of
> stdin. Does anybody know how to redirect tty to /dev/null?
> 
> $ unzip -p pasword_protected.zip file.txt < /dev/null
> [pasword_protected.zip] file.txt password:
[...]

You could always do:

unzip -P '' -p pasword_protected.zip file.txt

To prevent unzip from prompting from a password. That will fail
if the file is encrypted and the password happens not to be the
empty string, but I suppose that's what you're expecting when
you redirect the input from /dev/null.

Actually bsdtar (a more Unixy way to extract archives) suggests
an empty password is not "acceptable" for a zip file:

$ bsdtar --passphrase '' -xOf a.zip a
bsdtar: Empty passphrase is unacceptable

(I'm surprise bsdtar doesn't support passing passphrase via the
environment either).

-- 
Stephane




reply via email to

[Prev in Thread] Current Thread [Next in Thread]