DeutschEspañolFrançaisItalianoNederlandsPortuguêsΕλληνικάРусскийالعربية中文(简体)中文(繁體)日本語한국어
 
Donate Bitcoins
Google
 
www smithii.com
 

Cygwin Doesn't Register All Environment Variables When Using SSH

When initiating a Cygwin bash session via SSH, Cygwin only registers the environment variables for the SYSTEM account, not for the individual user's account.

So I added the following code to the end of my .bashrc file:

if [ "$SSH_TTY" ]; then
pushd . >/dev/null
for __dir in \
/proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Session\ Manager/Environment \
/proc/registry/HKEY_CURRENT_USER/Environment
do
	cd "$__dir"
	for __var in *
	do
		__var=`echo $__var | tr '[a-z]' '[A-Z]'`
		test -z "${!__var}" && export $__var="`cat $__var`" >/dev/null 2>&1
	done
done
unset __dir
unset __var
popd >/dev/null
fi

To apply this fix for all users, add it to /etc/profile instead.

Please note, this doesn't correctly register environment variable names that are illegal in Cygwin, such as those that contain a period.

DeutschEspañolFrançaisItalianoNederlandsPortuguêsΕλληνικάРусскийالعربية中文(简体)中文(繁體)日本語한국어
 
Donate Bitcoins
Google
 
www smithii.com
 
Special thanks to Riester Rente Online for a generous donation!