Shell中如何获得最新版本的PHP?
- 0次
- 2021-07-28 04:24:33
- idczone
我需要在Shell中获得最新PHP版本号,然后检查服务器是否需要升级。
比如 Apache 提供的下载是 http://www.apache.org/dist/httpd/ ,它将所有版本都列出来了,我可以通过elinks和awk轻松提取最新版本号,但是php要怎样做呢?
curl -s http://php.net/downloads.php | grep 'Current stable' | perl -nle 'print $1 if m/(\d+\.\d+\.\d+)/'
感谢
是我愚钝了,没想到用curl。segmentfault.com 中的“大盗贼”给出了我更喜欢的答案。
curl -s http://www.php.net/downloads.php |grep "Current stable" |awk '{print $3}'
curl -s http://www.php.net/downloads.php|awk '/Current stable/{print $3}'