This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: how to detect if Windows or Linux is running?
- From: "Buchbinder, Barry \(NIH/NIAID\)" <BBuchbinder at niaid dot nih dot gov>
- To: "H. S." <hs dot samix at gmail dot com>, <cygwin at cygwin dot com>
- Date: Fri, 2 Dec 2005 08:33:07 -0500
- Subject: RE: how to detect if Windows or Linux is running?
H. S. wrote:
> Buchbinder, Barry (NIH/NIAID) wrote:
>> H. S. wrote:
>>
>>> Christopher Faylor wrote:
>>>
>>>> On Thu, Dec 01, 2005 at 05:07:15PM -0500, H. S. wrote:
>>>>
>>>>
>>>>> Hi,
>>>>>
>>>>> I have installed Cygwin on a Windows XP computer to get rsync and
>>>>> ssh running so that I can backup my important data on a Linux
>>>>> computer on my home LAN. The idea is to use rsync to make rolling
>>>>> backups of my Windows data automatically, say, once or twice a day
>>>>> and to retain last N backups (N most probably going to be 10~20).
>>>>>
>>>>> But the problem I had not foreseen is that I dual boot this
>>>>> Windows machine between Windows XP and Debian. How should I
>>>>> gracefully let the rsync server know if this computer is running
>>>>> Linux or XP?
>>>>>
>>>>> I know that if the computer is running Linux, the rsync server
>>>>> will never find /cygdrive/... folders and will just quite with an
>>>>> error. But this is not 'clean', it will result in mails to the
>>>>> rsync server root about the error.
>>>>>
>>>>> Suggestions?
> <SNIP>
>>
>>
>> Perhaps you could look for environmental variables that Windows sets
>> but Linux doesn't. COMSPEC, windir, SystemDrive, SystemRoot,
>> ProgramFiles, CommonProgramFiles
>>
>
> er .. how can I do that using SSH and non-interactively?
>
> thanks,
> ->HS
From other postings, I see that you've found the answer to your
question. But for completeness in the archives ....
I don't use SSH so don't know what you are dealing with. But in shell
scripts,
if test -z "${NVAR}"
or
if test ! -z "${VAR}"
can test whether VAR has a value.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/