"php7.dll"을 모두 제거 하려고 합니다 sudo apt-get remove --purge
.” 패키지가 있는데 “php7.0”을 제외하고 싶습니다."패키지. 나는 이것을 시도했지만
sudo apt-get -y remove --purge php7.[^php7.0]*
성공하지 못했습니다. 나는 성공하지 못한 채 제안된 다른 유사한 솔루션을 많이 시도했습니다. 실제로 제외하고 싶은 패키지를 구체적으로 제거합니다. 누구든지 이 퍼즐을 해결했다면 대단히 감사하겠습니다. .
"우분투 16.04.4 LTS"
~$ dpkg -l | grep php7
ii php7.0-cli 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 command-line interpreter for the PHP scripting language
ii php7.0-common 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 documentation, examples and common module for PHP
ii php7.0-curl 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 CURL module for PHP
ii php7.0-fpm 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php7.0-gd 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 GD module for PHP
ii php7.0-imap 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 IMAP module for PHP
ii php7.0-intl 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 Internationalisation module for PHP
ii php7.0-json 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 JSON module for PHP
ii php7.0-ldap 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 LDAP module for PHP
ii php7.0-mbstring 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 MBSTRING module for PHP
ii php7.0-mcrypt 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 libmcrypt module for PHP
ii php7.0-mysql 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 MySQL module for PHP
ii php7.0-opcache 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 Zend OpCache module for PHP
ii php7.0-readline 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 readline module for PHP
ii php7.0-xml 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.0-zip 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 Zip module for PHP
ii php7.1 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 all server-side, HTML-embedded scripting language (metapackage)
ii php7.1-bcmath 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 amd64 Bcmath module for PHP
ii php7.1-bz2 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 amd64 bzip2 module for PHP
ii php7.1-cli 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 amd64 command-line interpreter for the PHP scripting language
ii php7.1-common 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 amd64 documentation, examples and common module for PHP
ii php7.1-curl 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 amd64 CURL module for PHP
ii php7.1-fpm 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php7.1-gd 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 amd64 GD module for PHP
ii php7.1-intl 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 amd64 Internationalisation module for PHP
ii php7.1-json 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 amd64 JSON module for PHP
ii php7.1-mbstring 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 amd64 MBSTRING module for PHP
ii php7.1-opcache 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 amd64 Zend OpCache module for PHP
ii php7.1-readline 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 amd64 readline module for PHP
ii php7.1-xml 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 amd64 DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.1-zip 7.1.33-16+ubuntu16.04.1+deb.sury.org+1 amd64 Zip module for PHP
ii php7.2 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 all server-side, HTML-embedded scripting language (metapackage)
ii php7.2-bcmath 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 Bcmath module for PHP
ii php7.2-bz2 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 bzip2 module for PHP
ii php7.2-cli 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 command-line interpreter for the PHP scripting language
ii php7.2-common 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 documentation, examples and common module for PHP
ii php7.2-curl 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 CURL module for PHP
ii php7.2-fpm 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php7.2-gd 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 GD module for PHP
ii php7.2-intl 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 Internationalisation module for PHP
ii php7.2-json 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 JSON module for PHP
ii php7.2-mbstring 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 MBSTRING module for PHP
ii php7.2-opcache 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 Zend OpCache module for PHP
ii php7.2-readline 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 readline module for PHP
ii php7.2-xml 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.2-zip 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 Zip module for PHP
ii php7.3 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 all server-side, HTML-embedded scripting language (metapackage)
ii php7.3-bcmath 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 Bcmath module for PHP
ii php7.3-bz2 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 bzip2 module for PHP
ii php7.3-cli 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 command-line interpreter for the PHP scripting language
ii php7.3-common 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 documentation, examples and common module for PHP
ii php7.3-curl 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 CURL module for PHP
ii php7.3-fpm 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php7.3-gd 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 GD module for PHP
ii php7.3-intl 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 Internationalisation module for PHP
ii php7.3-json 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 JSON module for PHP
ii php7.3-mbstring 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 MBSTRING module for PHP
ii php7.3-opcache 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 Zend OpCache module for PHP
ii php7.3-readline 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 readline module for PHP
ii php7.3-xml 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.3-zip 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 Zip module for PHP
"우분투 16.04.6 LTS"
~$ dpkg -l | grep php7
ii php-common 2:69+ubuntu16.04.1+deb.sury.org+2+php7.3 all Common files for PHP packages
ii php7.0 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 all server-side, HTML-embedded scripting language (metapackage)
ii php7.0-bcmath 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 Bcmath module for PHP
ii php7.0-bz2 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 bzip2 module for PHP
ii php7.0-cli 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 command-line interpreter for the PHP scripting language
ii php7.0-common 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 documentation, examples and common module for PHP
ii php7.0-curl 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 CURL module for PHP
ii php7.0-fpm 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php7.0-gd 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 GD module for PHP
ii php7.0-intl 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 Internationalisation module for PHP
ii php7.0-json 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 JSON module for PHP
ii php7.0-mbstring 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 MBSTRING module for PHP
ii php7.0-opcache 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 Zend OpCache module for PHP
ii php7.0-readline 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 readline module for PHP
ii php7.0-xml 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.0-zip 7.0.33-29+ubuntu16.04.1+deb.sury.org+1 amd64 Zip module for PHP
ii php7.1-cli 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 command-line interpreter for the PHP scripting language
ii php7.1-common 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 documentation, examples and common module for PHP
ii php7.1-curl 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 CURL module for PHP
ii php7.1-fpm 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php7.1-gd 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 GD module for PHP
ii php7.1-imap 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 IMAP module for PHP
ii php7.1-intl 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 Internationalisation module for PHP
ii php7.1-json 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 JSON module for PHP
ii php7.1-ldap 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 LDAP module for PHP
ii php7.1-mbstring 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 MBSTRING module for PHP
ii php7.1-mcrypt 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 libmcrypt module for PHP
ii php7.1-mysql 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 MySQL module for PHP
ii php7.1-opcache 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 Zend OpCache module for PHP
ii php7.1-readline 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 readline module for PHP
ii php7.1-xml 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.1-zip 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 amd64 Zip module for PHP
ii php7.2 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 all server-side, HTML-embedded scripting language (metapackage)
ii php7.2-bcmath 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 Bcmath module for PHP
ii php7.2-bz2 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 bzip2 module for PHP
ii php7.2-cli 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 command-line interpreter for the PHP scripting language
ii php7.2-common 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 documentation, examples and common module for PHP
ii php7.2-curl 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 CURL module for PHP
ii php7.2-fpm 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php7.2-gd 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 GD module for PHP
ii php7.2-intl 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 Internationalisation module for PHP
ii php7.2-json 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 JSON module for PHP
ii php7.2-mbstring 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 MBSTRING module for PHP
ii php7.2-opcache 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 Zend OpCache module for PHP
ii php7.2-readline 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 readline module for PHP
ii php7.2-xml 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.2-zip 7.2.31-1+ubuntu16.04.1+deb.sury.org+1 amd64 Zip module for PHP
ii php7.3 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 all server-side, HTML-embedded scripting language (metapackage)
ii php7.3-bcmath 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 Bcmath module for PHP
ii php7.3-bz2 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 bzip2 module for PHP
ii php7.3-cli 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 command-line interpreter for the PHP scripting language
ii php7.3-common 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 documentation, examples and common module for PHP
ii php7.3-curl 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 CURL module for PHP
ii php7.3-fpm 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php7.3-gd 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 GD module for PHP
ii php7.3-intl 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 Internationalisation module for PHP
ii php7.3-json 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 JSON module for PHP
ii php7.3-mbstring 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 MBSTRING module for PHP
ii php7.3-opcache 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 Zend OpCache module for PHP
ii php7.3-readline 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 readline module for PHP
ii php7.3-xml 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.3-zip 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 amd64 Zip module for PHP
답변1
정규식이 올바르지 않은 것 같습니다. 이는 "php7"과 임의의 문자(".")를 포함하는(반드시 끝나는 것은 아님) 패키지 이름과 일치하며 그 뒤에 p, h, 7, ., 0이 아닌 임의의 문자가 옵니다.
아마도 당신이 원하는 것은 다음과 같은 정규 표현식입니다:
sudo apt-get -y remove --purge '^php7\.[^0]'
이는 "php7"과 일치합니다. 패키지 이름(^)의 시작 부분에 0을 제외한 모든 문자를 추가합니다. 나중에 다른 캐릭터가 나올 수도 있지만, 그것에 대해 생각할 필요는 없습니다.
답변2
나는 무엇을 할 것인가:
sudo apt-get remove --purge $(
dpkg -l | awk '$1 == "ii" && /php7/ && !/php7\.0/{print $2}'
)
변수 전달앗-v
, 스위치 사용 :
EXCLUDE_VERSION='php7.0'
awk -v exv="$EXCLUDE_VERSION" '$1 == "ii" && /php7/ && $2 !~ exv{print $2}'