delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/07/20/10:57:58

DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 46KEvvLf1687862
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=FPGueNH5
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 02BE0385840D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1721487477;
bh=+CukDqYZ65UkKSoGgllYy+UBfGryb+2Tbamk9lmMGrA=;
h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=FPGueNH5JM8kzEvLSg44z+rQzERryd/RuJ3bSIy1i2IaUsGNFiCYbZNtJWRaJwonI
zpLwFNHU6SK/PRGiaWxNvBOhmCX59Ie8/WH2JuZn9PM96hGJnY5As63snsYCFLPQQz
GXN+bkIHy3r2ArvQKLZqjurgVuKRgoLBWRcZG/M8=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D8E643858C41
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D8E643858C41
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721487455; cv=none;
b=V6dQofOv0Tusz2+3mFsyNUdteQiauN8m0xarg/WtCj01XSHIzM5FXRqrUBeuqpBJnNrytDoFpObWh/qh96PRlKbHhMbDfkFOyZnWWsp8oOR3XDRzoIqncKpOFDcr5xDVJbPM8Z6TGqJt5m26x4yfMuiFabqC6he4ggZ+paLfpaM=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1721487455; c=relaxed/simple;
bh=KrzqKjnB7KlbWmpaK6PV0jsXBZPE3Ava9irKyxhOTYw=;
h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
b=wrt/fkrLlcyfsfcrOhRZKNDE4LgwVCQTmV6Y1+XrhCN9bYaiNT/sO5dFPJxiTlkx2ICQ+jPRC8IDkaBAOlaMYwA1HCGAB/TtRgJNSyE39m5MXDjV3qUTT0mp9l5IXQKCilS81iXkRMM7MJfi5dWMXPA6RdnkQw66uMa9lK+lfBI=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1721487453; x=1722092253;
h=content-transfer-encoding:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=KrzqKjnB7KlbWmpaK6PV0jsXBZPE3Ava9irKyxhOTYw=;
b=FqX/6Uf13EB9EsvJheb4zneElT0PAj9OS54hgDqIYfxKYDNxKQR8+RmnnpBmDircuu
zP9pTlJGnrVJK9ICfN82B9aLjuw4dZr85q7Ng2sJHTdmFh1w/+Ze83nqiiIfznnvwM83
MwqrHcS1NvoVVfJSjaODLDtP0VbpqBShlqdp60Y6xJJMlfV8GnFNQu1neEq7r7/TWweN
Eur+8k+UTTBclxca5ZK7zaqFS/Be+if1ulIpE9c28QgdX1EWvnCVzXba4OV/EZCarf/o
t56UtCiPj0+DlB8CpDETL8Q70z6zweLzeDcokQnKR9/5M0Dy36tT0B5iKQipVYdzDOqs
mrOw==
X-Gm-Message-State: AOJu0Yy45yXa+6reI81IT4DOqwxjAqfii1+5/koO99jROnV0Elj9Cqo8
Ac9mjPyEDtvFHdenks/4DtiqAz2FNLy+XqHl0nbpBaLc+WdjQfQbegCuGDcemhWIPDj+zf2i5Xl
F5XP68ttYyvAJ4nMWiqN2pmJRFV0MSRHN
X-Google-Smtp-Source: AGHT+IH+BXJTHf+Vl7B0YTc83qjm4v36FMp+uizdpxZjleZEuZO+u29kVmjDpcowQjdweFpnjE22CDBYUNQuNQtY6ew=
X-Received: by 2002:a17:90b:2303:b0:2ab:8324:1b47 with SMTP id
98e67ed59e1d1-2cd170c92f3mr4714164a91.15.1721487452536; Sat, 20 Jul 2024
07:57:32 -0700 (PDT)
MIME-Version: 1.0
References: <CAN0SSYzW_im0Fgucbsqk6u=Cu1suSmvhJbskH8doV98mMOTtUg AT mail DOT gmail DOT com>
<CANV9t=TCFTGisXDC6UJ5zR5Bk=CiFAwFSX=sRe1H+uSwNA7BpA AT mail DOT gmail DOT com>
In-Reply-To: <CANV9t=TCFTGisXDC6UJ5zR5Bk=CiFAwFSX=sRe1H+uSwNA7BpA@mail.gmail.com>
Date: Sat, 20 Jul 2024 16:56:56 +0200
Message-ID: <CAN0SSYwLfRUFypCGSo-k5iCi24ndLQwPT=pbGvkq0ptBkui8BQ@mail.gmail.com>
Subject: Re: Parse output of "net use", but language varies - force language
for "net use"?
To: cygwin AT cygwin DOT com
X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,
SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Mark Liam Brown via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Mark Liam Brown <brownmarkliam AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 46KEvvLf1687862

On Sat, Jul 20, 2024 at 4:31 PM Bill Stewart via Cygwin
<cygwin AT cygwin DOT com> wrote:
>
> On Sat, Jul 20, 2024 at 7:45 AM Mark Liam Brown via Cygwin wrote:
>
> I am trying to parse the output of "net use" in a bash script, but hit
> > a roadblock:
> > The output of "net use" changes with the language of the system
> > (English, Danish, French, ...), so parsing becomes nearly impossible
> >
> > How can I force the language used by "net use" to English, even if the
> > system default language is Danish or French?
> >
>
> This sounds like an XY problem[1] to me....
>
> What is the goal you're trying to accomplish? Enumerate existing
> connections? Get drive mappings?

Basically I need every bit of information out of "net use", "net
config", "net statistics", "net view" and so on, parse it in bash or
perl, process it in bash, and output it in JSON format from the bash
script for our (Linux-based) admin report interface.

Mark
-- 
IT Infrastructure Consultant
Windows, Linux

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019