From 9e9a58ff9fc12df223126d031d4b62e27ec1d65a Mon Sep 17 00:00:00 2001 From: Bruno21 Date: Mon, 6 Jan 2025 09:02:32 +0100 Subject: [PATCH] v1.1.1 bugfix with .env path --- bashbirds.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/bashbirds.sh b/bashbirds.sh index 0269a58..4b9a74e 100755 --- a/bashbirds.sh +++ b/bashbirds.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERSION="v1.1" +VERSION="v1.1.1" red="\033[1;31m" greenbold="\033[1;32m" @@ -13,32 +13,37 @@ italic="\033[3m" underline="\033[4m" reset="\033[0m" +### Variables for self updating +ScriptArgs=( "$@" ) +ScriptPath="$(readlink -f "$0")" # /Users/bruno/Documents/Scripts/bashbirds/bashbirds.sh +ScriptWorkDir="$(dirname "$ScriptPath")" # /Users/bruno/Documents/Scripts/bashbirds + dotenv () { set -a # shellcheck disable=SC1091 - [ -f ".env" ] && . ".env" || echo -e "${red}\nNo .env file found ! Could'nt get update from Github.'.${reset}" + [ -f "$ScriptWorkDir/.env" ] && . "$ScriptWorkDir/.env" || echo -e "${red}\nNo .env file found ! Could'nt get update from Github.'.${reset}" set +a } dotenv -### ChangeNotes: Minor corrections. + +### ChangeNotes: 1.1.1 Bugfix with .env path +# Minor corrections. Github="https://github.com/bruno21/bashbirds" # Repo normal: #RawUrl="https://raw.githubusercontent.com/Bruno21/bashbirds/main/bashbirds.sh" # Repo privé: RawUrl="https://x-access-token:$GITHUB_TOKEN@raw.githubusercontent.com/Bruno21/bashbirds/main/bashbirds.sh" -### Variables for self updating -ScriptArgs=( "$@" ) -ScriptPath="$(readlink -f "$0")" # /Users/bruno/Documents/Scripts/bashbirds/bashbirds.sh -ScriptWorkDir="$(dirname "$ScriptPath")" # /Users/bruno/Documents/Scripts/bashbirds - ### Check if there's a new release of the script: LatestRelease="$(curl -s -r 0-50 $RawUrl | sed -n "/VERSION/s/VERSION=//p" | tr -d '"')" LatestChanges="$(curl -s -r 0-200 $RawUrl | sed -n "/ChangeNotes/s/### ChangeNotes: //p")" #[[ $LatestRelease != $VERSION ]] && new="($LatestRelease)" || new="" +echo "$LatestRelease" +echo "$LatestChanges" + echo -e "${yellowbold}Bashbird${reset} $VERSION\n" @@ -71,7 +76,6 @@ req2() { #read -p "Pause: " choice - #query2="SELECT * FROM liste;" query2="SELECT Francais, Autres, Latin, Anglais, Ordre, Famille, Liens FROM liste;" result2=$(sqlite3 "$ScriptWorkDir/birds.db" "$query2") #echo "$result2" @@ -90,9 +94,6 @@ req2() { ln="${array[6]}" - #echo "$ln" - #read -r -p "Would you like to update? y/[n]: " SelfUpdate - [[ $aut != "" ]] && z="($aut)" || z="" if [ $ext = ".md" ]; then