summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSeth Vargo <[email protected]>2025-08-12 22:17:04 -0400
committerGitHub <[email protected]>2025-08-13 02:17:04 +0000
commit0e8bbfb8ba2b02f8e80850c7f6b444c72fbd7340 (patch)
treed3622bb7ba4d3a2b5a9910d6c78092fba6463c53 /scripts
parent9912577a2b425e3f1f5eb16a3ae3b9da0e49466d (diff)
chore: update bash to follow shellcheck recommendations (#6102)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/create_alias.sh29
1 files changed, 15 insertions, 14 deletions
diff --git a/scripts/create_alias.sh b/scripts/create_alias.sh
index ccaf3dd4..ecb01bb3 100755
--- a/scripts/create_alias.sh
+++ b/scripts/create_alias.sh
@@ -1,38 +1,39 @@
-#!/bin/bash
+#!/usr/bin/env bash
+set -euo pipefail
# This script creates an alias for the Gemini CLI
# Determine the project directory
PROJECT_DIR=$(cd "$(dirname "$0")/.." && pwd)
-ALIAS_COMMAND="alias gemini='node $PROJECT_DIR/scripts/start.js'"
+ALIAS_COMMAND="alias gemini='node "${PROJECT_DIR}/scripts/start.js"'"
# Detect shell and set config file path
-if [[ "$SHELL" == *"/bash" ]]; then
- CONFIG_FILE="$HOME/.bashrc"
-elif [[ "$SHELL" == *"/zsh" ]]; then
- CONFIG_FILE="$HOME/.zshrc"
+if [[ "${SHELL}" == *"/bash" ]]; then
+ CONFIG_FILE="${HOME}/.bashrc"
+elif [[ "${SHELL}" == *"/zsh" ]]; then
+ CONFIG_FILE="${HOME}/.zshrc"
else
echo "Unsupported shell. Only bash and zsh are supported."
exit 1
fi
-echo "This script will add the following alias to your shell configuration file ($CONFIG_FILE):"
-echo " $ALIAS_COMMAND"
+echo "This script will add the following alias to your shell configuration file (${CONFIG_FILE}):"
+echo " ${ALIAS_COMMAND}"
echo ""
# Check if the alias already exists
-if grep -q "alias gemini=" "$CONFIG_FILE"; then
- echo "A 'gemini' alias already exists in $CONFIG_FILE. No changes were made."
+if grep -q "alias gemini=" "${CONFIG_FILE}"; then
+ echo "A 'gemini' alias already exists in ${CONFIG_FILE}. No changes were made."
exit 0
fi
read -p "Do you want to proceed? (y/n) " -n 1 -r
echo ""
-if [[ $REPLY =~ ^[Yy]$ ]]; then
- echo "$ALIAS_COMMAND" >> "$CONFIG_FILE"
+if [[ "${REPLY}" =~ ^[Yy]$ ]]; then
+ echo "${ALIAS_COMMAND}" >> "${CONFIG_FILE}"
echo ""
- echo "Alias added to $CONFIG_FILE."
- echo "Please run 'source $CONFIG_FILE' or open a new terminal to use the 'gemini' command."
+ echo "Alias added to ${CONFIG_FILE}."
+ echo "Please run 'source ${CONFIG_FILE}' or open a new terminal to use the 'gemini' command."
else
echo "Aborted. No changes were made."
fi