Linux Bash/Shell获取MongoDB官网软件包下载链接
2021/7/10 19:07:11
本文主要是介绍Linux Bash/Shell获取MongoDB官网软件包下载链接,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
#!/bin/bash # 获取 MongoDB 官网各平台软件下载地址: # Require cURL command and jq command installed # 可携带参数: $1 --- 目标版本号,$2 --- 目标平台名称 (二者均可省略,默认获取最新版本Windows下载链接) jsonData=$(curl -sS 'https://www.mongodb.com/try/download/community'|pquery script -p text|grep -i '.msi'|sed -r 's/^.*?window\.__serverData=//') #latestedVersion=$(echo "$jsonData"|jq -r '.components[1].props.data[0].products[1].data'|awk 'NR==2{gsub(/"| /,"");gsub(/:.*$/,"");print;exit}') latestedVersion=$(echo "$jsonData"|jq -r '.components[1].props.data[0].products[1].data|keys|reverse[0]') echo "最新版本:$latestedVersion" targetPlatform="Windows" targetVersion="$latestedVersion" if [ $# -ge 1 ] then if [ ! -z "$1" ] then targetVersion="$1" shift fi [ ! -z "$1" ] && targetPlatform="$1" fi echo "------------------------------------------------------" echo "可用平台:" echo "$jsonData"|jq -r '.components[1].props.data[0].products[1].data."'"${targetVersion}"'".platforms|keys' echo "------------------------------------------------------" echo "Version $targetVersion For \"$targetPlatform\"" echo "$jsonData"|jq -r '.components[1].props.data[0].products[1].data."'"${targetVersion}"'".platforms."'"${targetPlatform}"'"' echo "------------------------------------------------------" # 自用附加:Version 4.4.6 For Windows echo "Version 4.4.6 For Windows" echo "$jsonData"|jq -r '.components[1].props.data[0].products[1].data."4.4.6".platforms.Windows'
这篇关于Linux Bash/Shell获取MongoDB官网软件包下载链接的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-11Linux部署Scrapy学习:入门级指南
- 2024-09-11Linux部署Scrapy:入门级指南
- 2024-08-21【Linux】分区向左扩容的方法
- 2024-08-21【Linux】gnome桌面环境切换KDE Plasma
- 2024-08-19如何安装 VMware Tools (macOS, Linux, Windows)
- 2024-08-15Linux部署Scrapy教程:入门级指南
- 2024-07-29linux命令行下好用的性能监控工具atop
- 2024-07-04Linux系统上离线升级SSH服务的具体操作步骤-icode9专业技术文章分享
- 2024-06-0600-macOS和Linux安装和管理多个Python版本
- 2024-03-30[译]漫画SELinux概念