mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-08 02:50:42 +00:00
fix(shell): use [[ instead of [ for conditional tests
Replace single brackets with double brackets in bash conditional expressions across 14 files (28 changes). All scripts use bash shebangs so [[ is safe everywhere (SonarCloud rule shelldre:S7688).
This commit is contained in:
@@ -7,13 +7,13 @@ DEFAULT_NAME="main"
|
||||
CURRENT_SESSION=$(tmux display-message -p "#{session_name}")
|
||||
|
||||
# Check that the session has a name
|
||||
if [ "$CURRENT_SESSION" = "#{session_name}" ] || [ "$CURRENT_SESSION" = "0" ]; then
|
||||
if [[ "$CURRENT_SESSION" = "#{session_name}" ]] || [[ "$CURRENT_SESSION" = "0" ]]; then
|
||||
# Check if the default name is already in use
|
||||
if tmux has-session -t "$DEFAULT_NAME" 2> /dev/null; then
|
||||
# Query the user for a new name
|
||||
echo "Session name '$DEFAULT_NAME' is already in use. Enter a new name:"
|
||||
read -r NEW_NAME
|
||||
while tmux has-session -t "$NEW_NAME" 2> /dev/null || [ -z "$NEW_NAME" ]; do
|
||||
while tmux has-session -t "$NEW_NAME" 2> /dev/null || [[ -z "$NEW_NAME" ]]; do
|
||||
echo "Name '$NEW_NAME' is invalid or already in use. Enter a new name:"
|
||||
read -r NEW_NAME
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user