| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW |
| X-Spam-Check-By: | sourceware.org |
| Message-ID: | <4D708610.4060409@cpan.org> |
| Date: | Fri, 04 Mar 2011 01:26:24 -0500 |
| From: | Rafael Kitover <rkitover AT cpan DOT org> |
| Reply-To: | rkitover AT cpan DOT org |
| User-Agent: | Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.14) Gecko/20110221 Thunderbird/3.1.8 |
| MIME-Version: | 1.0 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: ssh and user env vars from control panel |
| References: | <4D6DB62D DOT 4050108 AT cpan DOT org> |
| In-Reply-To: | <4D6DB62D.4050108@cpan.org> |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
I made this block for my .zshrc and .bashrc :
if [ -z "$APPDATA" ]; then
# ssh session, set env vars
# this from Corinna at http://cygwin.com/ml/cygwin/2010-08/msg00246.html
_sid=$(grep "^$USER:" /etc/passwd | sed -e 's/[^:]*:[^:]*:[^:]*:[^:]*:[^:]*,\(S-1-5-[^:]*\):.*/\1/')
_prof=$(cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows\ NT/CurrentVersion/ProfileList/${_sid}/ProfileImagePath)
export APPDATA="${_prof}\\AppData\\Roaming"
export LOCALAPPDATA="${_prof}\\AppData\\Local"
unset _sid
unset _prof
echo | powershell -noprofile -command '$env = [environment]::GetEnvironmentVariables("User"); foreach ($key in $env.Keys) { $line = "export " + $key + "=" + "'\''" + $env.$key + "'\''"; write-host $line }' | while read -r env_var; do
if echo $env_var | grep -q '^export HOME=' \
|| echo $env_var | grep -q '^export PATH='; then
continue
fi
eval $env_var
done
unset env_var
fi
maybe someone else will find it useful.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |