gpakosz / .tmux

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️
MIT License
21.73k stars 3.34k forks source link

Tmux installed on remote Linux server doesn't show `custom variables` #689

Closed ww7 closed 8 months ago

ww7 commented 8 months ago

Custom and predefined custom variables:

# online() {
#   ping -c 1 1.1.1.1 >/dev/null 2>&1 && printf '✔' || printf '✘'
# }
# 
# myip() {
#   IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
#   VPN=("130.61.32.181" "1.1.1.1")
#   if [[ -z $IP ]]; then exit; fi
#   if [[ ${VPN[@]} =~ $IP ]]; then echo "VPN: $IP"; else echo "IP: $IP"; fi
#   sleep 5
# }

On mine local macbook #{myip} works at tmux_conf_theme_status_right, but with Oh my tmux! installed on remote Linux (Ubuntu 20.04 with Tmux 3.1) it prints empty value. The function works in Bash. Also #{online} is epmty.

ww7 commented 8 months ago

Somehow problem in line with array variable

VPN=("130.61.32.181" "1.1.1.1")

Removing it is resolving the issue. On mac it works...

gpakosz commented 8 months ago

Hello @ww7

Custom variables must be implemented in POSIX shell.

On macOS, /bin/sh runs Bash

$ sh --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin22)
Copyright (C) 2007 Free Software Foundation, Inc.
ww7 commented 8 months ago

@gpakosz thanks!