bugfix with .env path
This commit is contained in:
2025-01-06 09:02:32 +01:00
parent 1e25f72eff
commit 9e9a58ff9f

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VERSION="v1.1" VERSION="v1.1.1"
red="\033[1;31m" red="\033[1;31m"
greenbold="\033[1;32m" greenbold="\033[1;32m"
@@ -13,32 +13,37 @@ italic="\033[3m"
underline="\033[4m" underline="\033[4m"
reset="\033[0m" 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 () { dotenv () {
set -a set -a
# shellcheck disable=SC1091 # 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 set +a
} }
dotenv dotenv
### ChangeNotes: Minor corrections.
### ChangeNotes: 1.1.1 Bugfix with .env path
# Minor corrections.
Github="https://github.com/bruno21/bashbirds" Github="https://github.com/bruno21/bashbirds"
# Repo normal: # Repo normal:
#RawUrl="https://raw.githubusercontent.com/Bruno21/bashbirds/main/bashbirds.sh" #RawUrl="https://raw.githubusercontent.com/Bruno21/bashbirds/main/bashbirds.sh"
# Repo privé: # Repo privé:
RawUrl="https://x-access-token:$GITHUB_TOKEN@raw.githubusercontent.com/Bruno21/bashbirds/main/bashbirds.sh" 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: ### 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 '"')" 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")" LatestChanges="$(curl -s -r 0-200 $RawUrl | sed -n "/ChangeNotes/s/### ChangeNotes: //p")"
#[[ $LatestRelease != $VERSION ]] && new="($LatestRelease)" || new="" #[[ $LatestRelease != $VERSION ]] && new="($LatestRelease)" || new=""
echo "$LatestRelease"
echo "$LatestChanges"
echo -e "${yellowbold}Bashbird${reset} $VERSION\n" echo -e "${yellowbold}Bashbird${reset} $VERSION\n"
@@ -71,7 +76,6 @@ req2() {
#read -p "Pause: " choice #read -p "Pause: " choice
#query2="SELECT * FROM liste;"
query2="SELECT Francais, Autres, Latin, Anglais, Ordre, Famille, Liens FROM liste;" query2="SELECT Francais, Autres, Latin, Anglais, Ordre, Famille, Liens FROM liste;"
result2=$(sqlite3 "$ScriptWorkDir/birds.db" "$query2") result2=$(sqlite3 "$ScriptWorkDir/birds.db" "$query2")
#echo "$result2" #echo "$result2"
@@ -90,9 +94,6 @@ req2() {
ln="${array[6]}" ln="${array[6]}"
#echo "$ln"
#read -r -p "Would you like to update? y/[n]: " SelfUpdate
[[ $aut != "" ]] && z="($aut)" || z="" [[ $aut != "" ]] && z="($aut)" || z=""
if [ $ext = ".md" ]; then if [ $ext = ".md" ]; then