Created
September 29, 2020 11:15
-
-
Save pd12bb/c9601d143a706a729f1770cb98a8c6d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ## vmess订阅生成脚本,参数1为节点信息的jsonc 列表,参数2为输出 | |
| raw=$(cat "$1" | sed -e 's/\/\/.*//g' -e 's/[[:blank:]]*$//g' -e 's/^[[:blank:]]*//g' | tr -d '\n' | sed -e 's/}{/}\n{/g') | |
| target="$2" | |
| number=$(echo "$raw" | grep -c '{') | |
| for ((i=1;i<="$number";i++)); do | |
| encoded=$(echo "$raw" | sed -n -e "${i} p" | base64 -w 0) | |
| vmess[$i]="vmess://${encoded}" | |
| done | |
| echo ${vmess[@]} | tr ' ' '\n' | base64 -w 0 > "${target}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment