Conflict between tmux and cygwin

Keith Thompson Keith.S.Thompson@gmail.com
Sat Dec 7 02:48:50 GMT 2024


It's not really a tmux issue. You can demonstrate it just by invoking
a shell.

For example, if you "cd /tmp" and then invoke a new shell with
"bash -l", the code in /etc/profile will cd to your home directory.
(This doesn't happen on Ubuntu, for example, which has a
different /etc/profile.)

But if you invoke bash without "-l", or with "CHERE_INVOKING=1 bash
-l", the new shell will have /tmp as its current directory.

"chere" is a script, installable via Cygwin setup, that enables
opening a Cygwin terminal in a specific directory via the Windows
Explorer context menu (right-click). I haven't tried it myself yet.

Here's the relevant code from /etc/profile :

# Make sure we start in home unless invoked by CHERE
if [ ! -z "${CHERE_INVOKING}" ]; then
  unset CHERE_INVOKING
else
  cd "${HOME}" || echo "WARNING: Failed attempt to cd into ${HOME}!"
fi


More information about the Cygwin mailing list