Tmux detached session - mate-terminal - command not found

I’ve found a very weird problem with tmux in a detached session. I am running Mate desktop 1.22. (My system is also updated)

I create a session called MAIL with a windows on it called win1 and detached:
johndoe@calculate ~ $ tmux new-session -s MAIL -n win1 -d

While outside tmux session I send a “ls” command:
johndoe@calculate ~ $ tmux send-keys -t MAIL ​'ls'​ C-m

I attach to the session and I get the following:
johndoe@calculate ~ $ tmux a
johndoe@calculate ~ $ ​ls​
-bash: ​ls: command not found

If I execute “ls” while inside the session it works perfectly fine.

Other tests I’ve done consist of running the same sequence in Xterm emulator and it works fine. It also runs as expected from out of graphical environment (Ctrl-alt-F1).
I’ve also installed mate-terminal in other computer with Funtoo linux (i3 windows manager). It works as expected.
I’ve been digging around this a lot and I can’t find the problem. Hope somebody has a clue…

The bash error “xxxxxx: command not found” shows up when you try to run a command/program that’s not installed or not in the path, etc.
Try opening a terminal and type

source ~/.bashrc

If the error shows up, then it’s definitely something in there that’s the problem. Look through the file for the line that causes the error - could go line by line pasting into a terminal if it’s not overwhelming, or add echo "step 1"echo "step 2" etc lines to narrow it down. Then remove/modify the offending line.
I hope this helps!

dafont showbox adam4adam