diff --git a/jfrog-oauth/run.sh b/jfrog-oauth/run.sh index ff0e1e0..678665b 100644 --- a/jfrog-oauth/run.sh +++ b/jfrog-oauth/run.sh @@ -102,8 +102,11 @@ fi # Configure the JFrog CLI completion echo "📦 Configuring JFrog CLI completion..." -SHELLNAME=$(basename $SHELL) +## Get the user's shell +SHELLNAME=$(grep "^$USER" /etc/passwd | awk -F':' '{print $7}' | awk -F'/' '{print $NF}') +## Generate the completion script jf completion $SHELLNAME --install +## Add the completion script to the user's shell profile if [ "$SHELLNAME" == "bash" ] || [ "$SHELLNAME" == "zsh" ]; then if ! grep -q "source $HOME/.jfrog/jfrog_$${SHELLNAME}_completion" ~/.$${SHELLNAME}rc; then echo "source $HOME/.jfrog/jfrog_$${SHELLNAME}_completion" >> ~/.$${SHELLNAME}rc diff --git a/jfrog-token/run.sh b/jfrog-token/run.sh index 439430c..ed3eb9c 100644 --- a/jfrog-token/run.sh +++ b/jfrog-token/run.sh @@ -102,8 +102,11 @@ fi # Configure the JFrog CLI completion echo "📦 Configuring JFrog CLI completion..." -SHELLNAME=$(basename $SHELL) +## Get the user's shell +SHELLNAME=$(grep "^$USER" /etc/passwd | awk -F':' '{print $7}' | awk -F'/' '{print $NF}') +## Generate the completion script jf completion $SHELLNAME --install +## Add the completion script to the user's shell profile if [ "$SHELLNAME" == "bash" ] || [ "$SHELLNAME" == "zsh" ]; then if ! grep -q "source $HOME/.jfrog/jfrog_$${SHELLNAME}_completion" ~/.$${SHELLNAME}rc; then echo "source $HOME/.jfrog/jfrog_$${SHELLNAME}_completion" >> ~/.$${SHELLNAME}rc