delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/07/21/17:20:33

DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 46LLKX6R2181820
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=QPk5zvex
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9DED385DDDE
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1721596832;
bh=clrGjk4xa2ZSNypBz805LuhgfzT4dvZ1lMaVfRBPARo=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=QPk5zvexhX7+ykYTc7mS4L5m3u0M0lKisunH/XG59Z/KeftqED71MvHXAirx2CHWw
3mw01W9qjlj5juD+tEu0mzFKM5UzF6hoeSfI/Amjhxl2UPz8RnVTbR9LTjtRbfYZpT
x15PpoWS8SkiKIhISfbuPSAS/vKCas+0myONPUHY=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 66AF33858C98
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 66AF33858C98
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721596806; cv=none;
b=hN0dmjOEdxMV2kjFMmsCGJbGKti9uYZ2lyCHEJpKmcYNwkxBINUE/Z+ZnPWevOhAOaq225h3fPuWEn5GIo1Iz5gXoFKwlaKXWf8q/2vRdTY/KURyhY9dXsuFpSHrGt3RTsC7D0ZQl4trEyfWbIn3aJ2vGAR0Wa7mUEZN1p3aXak=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1721596806; c=relaxed/simple;
bh=4IhidqIWeBBlyFNtBhfSjO4WYpjA72+wW1Tsf208SLo=;
h=DKIM-Signature:Date:From:Message-ID:To:Subject:MIME-Version;
b=F/goSlyyfbMlwBoX4jrtBa781uBbD0ve0+YFEqsnWPWAZQmG6QiR3QvK00c3/BWTAQCxuQ1STzxeRmOiavu0BGrQccF8I1X/SjVLtwjPejiLpuqgByAolEcAlVEhLDeT0SllONMR2yYRMGVK5JoI73R+M+kzZekPGlKqi0o2nrs=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Yandex-Fwd: 1
Date: Mon, 22 Jul 2024 00:05:07 +0300
X-Mailer: The Bat! (v9.3.4) Professional
Message-ID: <1972866414.20240722000507@yandex.ru>
To: Mark Liam Brown <brownmarkliam AT gmail DOT com>, cygwin AT cygwin DOT com
Subject: Re: Parse output of "net use",
but language varies - force language for "net use"?
In-Reply-To: <CAN0SSYzW_im0Fgucbsqk6u=Cu1suSmvhJbskH8doV98mMOTtUg@mail.gmail.com>
References: <CAN0SSYzW_im0Fgucbsqk6u=Cu1suSmvhJbskH8doV98mMOTtUg AT mail DOT gmail DOT com>
MIME-Version: 1.0
X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_THEBAT,
NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP,
XM_LIGHT_HEAVY autolearn=no 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-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
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: Andrey Repin via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Andrey Repin <anrdaemon AT yandex DOT ru>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

Greetings, Mark Liam Brown!

> 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?

chcp 65001

Make a symlink to chcp.com from /usr/local/bin/chcp for easier access.
Forcing unicode console CP makes many system programs (netsh, net, route,
ipconfig of what I tried) switch to what appears to be an equivalent of
C.UTF-8 locale, making their output consistent across different OS
localizations.

But frankly, if you really need automation in windows, PowerShell if here
to help. You would be able to do everything in a single, reasonable portable
script, and not need to involve Cygwin at all.


-- 
With best regards,
Andrey Repin
Monday, July 22, 2024 00:01:16

Sorry for my terrible english...


-- 
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