I want to alias a command that creates a new tmux session in the folder I'm currently in, and sets the folder name (hyphenated) as the session name. If the session already exists, tmux attaches to it:
alias tses="tmux new -As $(basename $PWD | tr . -)"
When I run the command in my shell like so: tmux new -As $(basename $PWD | tr . -)
it works as expected. But when I run the alias tses
, it always sets the name of my home folder as the session name.
Why is that and how can I fix it to work as expected?