On 2023-09-24, John Crawley wrote: > errors=$( sudo apt-get install mirage 2>&1 1>/dev/tty ) > echo "$errors"
#!/bin/bash errors=$(sudo apt-get install unknown 2>&1 1>/dev/tty) echo "output: $errors" errors=$(sudo apt-get install mirage 2>&1 1>/dev/tty) echo "output: $errors" debian version 12.1 ii apt 2.6.1 amd64 ii bash 5.2.15-2+b2 amd64 ii sudo 1.9.13p3-1+deb12u1 amd64 > Going straight to "Abort" which is what happens if apt has no stdin. But > surely it does? > > Running the same command on Debian 11 works as expected, waiting for USER > response at the prompt. # ./test Reading package lists... Done Building dependency tree... Done Reading state information... Done output: E: Unable to locate package unknown Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: gir1.2-gexiv2-0.10 The following NEW packages will be installed: gir1.2-gexiv2-0.10 mirage 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 120 kB of archives. After this operation, 649 kB of additional disk space will be used. Do you want to continue? [Y/n] n Abort. output: It waits until I type 'n' Perhaps you have another command disturbing tty ? Or check sudo ?