Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)DJ
Posts
0
Comments
1
Joined
2 yr. ago

  • This tmux wrapper is remarkably convenient:

    Usage:

     
        
    # Usage: t [session-name]
    #
    # With no arguments:
    #   Lists existing tmux sessions, or prints "[No sessions]" if none exist.
    #
    # With a session name:
    #   Attempts to attach to the named tmux session.
    #   If the session does not exist, creates a new session with that name.
    #
    # Examples:
    #   t            # Lists all tmux sessions
    #   t dev        # Attaches to "dev" session or creates it if it doesn't exist
    
    function t {
        if [[ -z $1 ]]; then
            tmux ls 2> /dev/null || echo "[No sessions]"
        else
            tmux attach -t $@ 2> /dev/null
            if [[ $? -ne 0 ]]; then
                tmux new -s $@
            fi
        fi
    }