#!/bin/bash ###################################################################### ### bash <(curl -fsSL https://raw.lhy.life/discard/llvm.sh) --version=18 ## ###################################################################### ## GetArgValue ## ./script --key=value g_args=("$@") function GetArgValue() { local key="$1" local defvalue="$2" for arg in "${g_args[@]}" do if [[ "$arg" == "--$key="* ]] then echo "${arg#*=}" return fi done echo "$defvalue" } VERSION=$(GetArgValue "version" "18") ## clean apt purge 'clang*' 'llvm*' -y apt autopurge -y ## depend apt update && apt install -y lsb-release wget software-properties-common gnupg g++-multilib wget git make bash <(curl -fsSL https://apt.llvm.org/llvm.sh) $VERSION all ## add global path echo "export PATH=/usr/lib/llvm-$VERSION/bin:\$PATH" >> /etc/profile echo 'export CC=clang' >> /etc/profile echo 'export CXX=clang++' >> /etc/profile