Enviado em 05/09/2021 - 13:18h
Pessoal, bom dia.deb = os.popen("comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u)").read( ).strip( ).split( )
/bin/sh: 1: Syntax error: "(" unexpected
/bin/sh: 1: cannot open (apt-mark: No such file sort: invalid option -- ')' Try 'sort --help' for more information. /bin/sh: 1: cannot open (gzip: No such file [] SE DESEJA DESINSTALAR MAIS DE UM APLICATIVO, DIGITE CADA NÚMERO CORRESPONDENTE SEPARADO APENAS POR ESPAÇO 0 - VOLTAR >
from subprocess import getoutput deb = getoutput("comm -23 <\(apt-mark showmanual | sort -u\) <\(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u\)").strip( ).split( )
['/bin/sh:', '1:', 'cannot', 'open', '(apt-mark:', 'No', 'such', 'file', 'sort:', 'invalid', 'option', '--', "')'", 'Try', "'sort", "--help'", 'for', 'more', 'information.', '/bin/sh:', '1:', 'cannot', 'open', '(gzip:', 'No', 'such', 'file'] SE DESEJA DESINSTALAR MAIS DE UM APLICATIVO, DIGITE CADA NÚMERO CORRESPONDENTE SEPARADO APENAS POR ESPAÇO 1 - /bin/sh: 2 - 1: 3 - cannot 4 - open 5 - (apt-mark: 6 - No 7 - such 8 - file 9 - sort: 10 - invalid 11 - option 12 - -- 13 - ')' 14 - Try 15 - 'sort 16 - --help' 17 - for 18 - more 19 - information. 20 - /bin/sh: 21 - 1: 22 - cannot 23 - open 24 - (gzip: 25 - No 26 - such 27 - file 0 - VOLTAR
Enviado em 05/09/2021 - 13:28h
Tenta digitar o comando no terminal diretamente e depois passa para o interpretador Python. Além disso procure usar boas práticas quando digitando comandos em shell, por exemplo, o uso de:${comando}
Enviado em 05/09/2021 - 13:42h
${comando}
Enviado em 06/09/2021 - 14:00h
Eu consegui um comando que "bateu na trave" e eu tive que tratar ele no Python pra fazer o que eu preciso.import os inst = os.popen("cat /var/log/apt/history.log | awk '{if ($3==\"install\" ) {print substr($0,index($0,$4))}}'").read( ).strip( ).split( ) excpt = ['--upgrade', 'update', '--no-install-recommends'] deb = list(set([x for x in inst if (len(x) > 2) and (not x in excpt)]))
Resolver problemas de Internet
Como compartilhar a tela do Ubuntu com uma Smart TV (LG, Samsung, etc.)
Descritores de Arquivos e Swappiness
Como instalar no Linux Jogos da Steam só para Windows
Instalando o Team Viewer no Debian Trixie - problema no Policykit
O Que Fazer Após Instalar Ubuntu 25.04
Erro ao atualizar o archlinux [RESOLVIDO] (3)
O que você está ouvindo agora? [2] (176)