From ad3c854e3e7c5c1b3eaa1b8da63176e2afb8ee53 Mon Sep 17 00:00:00 2001 From: pika <67532734+pik4li@users.noreply.github.com> Date: Sat, 11 Jan 2025 19:02:52 +0100 Subject: [PATCH] changed the function for installing oh-my-posh --- .bashrc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.bashrc b/.bashrc index 4edec9a..94b4f6f 100644 --- a/.bashrc +++ b/.bashrc @@ -94,6 +94,27 @@ _init() { else if command_exists curl; then curl -s https://ohmyposh.dev/install.sh | $_sudo bash -s -- -d /usr/bin/ + binDirs=( + "$HOME/.local/bin" + "/usr/local/bin" + "/usr/bin" + ) + + while ! command_exists oh-my-posh; do + for binDir in "${binDirs[@]}"; do + case "$binDir" in + "$HOME/.local/bin") + echo_info "Installing oh-my-posh into $binDir" + curl -s https://ohmyposh.dev/install.sh | bash -s -- -d "$binDir" + ;; + *) + echo_info "Installing oh-my-posh into $binDir" + curl -s https://ohmyposh.dev/install.sh | $_sudo bash -s -- -d "$binDir" + ;; + esac + + done + done fi fi }