Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Saints should always be judged guilty until they are proven innocent. -- George Orwell


devel / comp.lang.python / Re: How to enter escape character in a positional string argument from the command line?

SubjectAuthor
* Re: How to enter escape character in a positional string argumentLars Liedtke
`* Re: How to enter escape character in a positional string argument from the commaStefan Ram
 +- Re: How to enter escape character in a positional string argumentChris Angelico
 +* Re: How to enter escape character in a positional string argumentfromgene heskett
 |`* Re: How to enter escape character in a positional string argumentfrom the commanStefan Ram
 | `- Re: How to enter escape character in a positional string argumentfrom the commanStefan Ram
 +- Re: How to enter escape character in a positional string argumentfromChris Angelico
 `* Re: How to enter escape character in a positional string argument from the commaDennis Lee Bieber
  `* Re: How to enter escape character in a positional string argument from the commaStefan Ram
   `- Re: How to enter escape character in a positional string argument from the commaDennis Lee Bieber

1
Re: How to enter escape character in a positional string argument from the command line?

<mailman.1286.1671627449.20444.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=25257&group=comp.lang.python#25257

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: lal@solute.de (Lars Liedtke)
Newsgroups: comp.lang.python
Subject: Re: How to enter escape character in a positional string argument
from the command line?
Date: Wed, 21 Dec 2022 13:50:02 +0100
Organization: solute GmbH
Lines: 62
Message-ID: <mailman.1286.1671627449.20444.python-list@python.org>
References: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com>
<9889d5d4-3a41-4b7c-f709-b1810a09880e@solute.de>
Mime-Version: 1.0
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de nHu1dL99Go6mZ0JdIk5L0QAr+HOFWa8Gjie2zWw+bJog==
Return-Path: <lal@solute.de>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.012
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '2022': 0.05; 'angelico':
0.09; 'git': 0.09; 'schrieb': 0.09; 'ultimate': 0.09; 'url:de':
0.09; '&gt;': 0.14; '721': 0.16; '=====': 0.16; 'bash': 0.16;
'brands': 0.16; 'gmbh': 0.16; 'instead.': 0.16; 'sitz': 0.16;
'subject:string': 0.16; 'to?': 0.16; 'url-ip:104.22.46.190/32':
0.16; 'url-ip:104.22.46/24': 0.16; 'url-ip:104.22.47.190/32':
0.16; 'url-ip:104.22.47/24': 0.16; 'url-ip:172.67.5.43/32': 0.16;
'url-ip:172.67.5/24': 0.16; 'wrote:': 0.16; 'to:addr:python-list':
0.20; 'subject:How': 0.23; 'received:de': 0.23; 'register': 0.25;
'chris': 0.28; 'header:User-Agent:1': 0.30; 'dec': 0.31;
'header:Organization:1': 0.31; 'url-ip:188/8': 0.31; 'everyone':
0.32; 'assume': 0.32; 'but': 0.32; 'path': 0.33; 'windows': 0.34;
'header:In-Reply-To:1': 0.34; 'people': 0.36; 'subject:from':
0.37; 'using': 0.37; "it's": 0.37; 'could': 0.38; 'quite': 0.39;
'use': 0.39; 'wed,': 0.39; 'received:213': 0.40; 'policy': 0.62;
'germany': 0.62; 'skip:z 10': 0.62; 'privacy': 0.64; 'similar':
0.65; 'url:png': 0.66; 'now,': 0.67; 'amtsgericht': 0.69; 'der':
0.69; 'url-ip:134/8': 0.69; 'url:php': 0.75; 'cheers': 0.76;
'dr.': 0.77; 'court:': 0.84; 'subject: \n ': 0.84; 'url:cdn': 0.84
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=f0npcgTlu1VMmxgvVp3viF34QlIxd2xvinVj7pMRhJEkAW5v1ZM51jzxhLgSltvzSpxX0ttCejgskLciF6h8zETDWZAwr67P18JP7ntPq9GGbnD7myhPHX8xY7qYrJ8I983NJxbMYJQLU8NS9UwMK2U+rKqmUGU57z8zk8kmPzto1C7LDnrZu6WuviAarf5R6iNtAvdaDJZvPjL7FLe2NawjJFTqPOKb/wwyIEqqLAULMjgXJsBQiCeTx4+fa3vc7PSaWgrTAT6phqCueeV9NTD5GOXmHy0CGeMUMFveVEabTtCxqBtDdIy2CyvmucwdJaNmPkOE8AXoV8XHQlGeeA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector9901;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=vHoAWneevcwW5WhWEw+v/vRE49ooVw0B+twNRvMVR2c=;
b=YCXV1Oz53Pr0R5MqByn1e6V4e5XN2TfIxqVVsY28H9yuH91+Sm3xAcliJ4CrolsQLGtoxcn6ruuLEmSRkGSm3vP1SSxRvm+qUHNzSZ+1br4jTmC90H38FyHfcun6+6SzZJTPLhTVzkkLyU/9GrWpvaqpNKeqM7UdY6avhZOF1SGs8KO6GiuXeJXRnUMbG6vZbSWwaOgXf4Y0kvvJ/8jWe0yUn+O23tV7nzmt+/8v+XB5+dZCUxr1OCDVPNtCQ0kRLt8ZRMEj4mKNYGN2zqrq7Qv6OrP1YNeXOZtBjXMwC/FKqR2BFVRu1UJxTpveI73RWOOUQ4HzcnwVjoSeDs09DA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=solute.de; dmarc=pass action=none header.from=solute.de;
dkim=pass header.d=solute.de; arc=none
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=solute.de;
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Content-Language: en-US
In-Reply-To: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com>
X-ClientProxiedBy: FR3P281CA0132.DEUP281.PROD.OUTLOOK.COM
(2603:10a6:d10:94::12) To AM6PR05MB4997.eurprd05.prod.outlook.com
(2603:10a6:20b:10::22)
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: AM6PR05MB4997:EE_|DU0PR05MB10121:EE_
X-MS-Office365-Filtering-Correlation-Id: 4d6e65b2-78ef-4946-aa9a-08dae351e160
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: LOz09quXWnaUKpLnw7zZdalRTDErHL36Mo54Gs7ZiKGrRz1Ow0/x0SgoKimg8Rp3fRbd9MmB/hgPeE764N4MgZ+yBiFuoU/9K3ltWIadmbUotbTC8PGWsCd78xOv4lqmJV3y7/Rr1tUZM5l3tcNgYReyuo8ccRMbhatzx0uO3tT7TqbTtSW+izG4TEy+1pl+/w7pQPPMe9VzFDazN5NupesSTDnlOcxunmy77vu8ub41jtR40PMctsVKyDbjqjkvE6eNqOerKCK+/3dOsdxrjrN8nDcczBde/RqfmvvY6spYoWsEKLi7R6xUF1pGyX/34OXIUlSMdE/6fphJ9bytViXd+Xfiw9E92K9D0T9JRuO/7L3alSjg39NIxH5Llw6vjVPP2p8oQ+D3XcJGCukmjHdg08JxUHyVNloCglCMuVFpkDnmXTO+6WS2ltvDs1kODSkupECL552qCppIYwPJR+ty/2hNsXWSOO7CEkc7GQ7yn9kA9pKiBggD7M8Q4a/o/77NhacaygW6B/cUOzyMEyuOquDWnGZ3GLgqe+E1Z4h2gn2Hs6QTozMhvX5L7mek41tyoEkERfbSSDYdAXqWZ5PccNVSMgf/uv7Y4/oQSWwJQSrq7CDFfoiBgp6F8t53Drp6/LASJn+MsZwHFZgO1Re7a6TIrAxKMrNEEPdihIMdYu9FudbLArjdzSK6hHCrLeWih3hnyyUb14dJRXfYQn6HzjuZQtLXktZ/Ww82lHtPJjc7D1s+FfEYZtlLg+pDQP3/wyhbeX8xGrMaQtO2+RrcCRs7qNW/9aDFgUHGUeE=
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
IPV:NLI; SFV:NSPM; H:AM6PR05MB4997.eurprd05.prod.outlook.com; PTR:; CAT:NONE;
SFS:(13230022)(4636009)(376002)(396003)(136003)(346002)(366004)(39830400003)(451199015)(36756003)(86362001)(33964004)(316002)(31696002)(478600001)(6916009)(6486002)(66476007)(966005)(8676002)(5660300002)(66946007)(41300700001)(36916002)(8936002)(66556008)(2906002)(6506007)(26005)(38100700002)(166002)(6512007)(186003)(53546011)(31686004)(2616005)(45980500001)(43740500002)(460985005);
DIR:OUT; SFP:1102;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: 6d1jlWlpNSk0wrfv2F972EC8eb9W6lzE5pgTDhdVzl+Xq
O3l8YiPUFUDkBssRFGbougZgQHMCYWd41m0H+/BC5mihP
rZdYeW4bTAfu2fVUsWH4B2yLDLjF+DElKWj5TbxsLdQaK
0pGzM5fGqUFh3O8D4h/L5pW9f6OCpy98Utj/pt2zQh2Ad
zlgFKO+nLKbMkq8Vd9chbRy6bDprFMZ6lBK1VzGSAde15
C35zXZXw7kUEufXNqGfDI4ZX4PeFyP2MnlwPB6RVhItTE
0wvGTb5vq/GyFr/PsMLr/l0Bf0WOD7g65YmaXUVHj4Rya
NKe4F0vR2cDWkSFy2tP3qI17WmWN7EV3gDSe+YfmzUx2q
E2lpsTZP0K1VhI+/jHLfYsdrhfMLunHcSrKqFFy1QDvzM
vRYmhekJCIs90uxna8zYV7+fTc5tk9UbHkc3aK9a7mk1p
9TX0AEX0R1xBnkRy5goXaoHoXCdZpTC2vYLrhCjoVn7CU
9KgQ/2MTZZbJ0JoB8Q62UebOafjd7bNV8ti7E2sMJfoce
QPVulxm48JxTKwxIqy+C2f19SWtKt60E5kY3JmUBavWkj
v5FgQuBDJlIyHRZvgXGfVtolfN34TCXpYFoUPmFmq7D+v
W9Eq+HXoYETv7AXpbzhNdZlEyILuFgdeLooyNAlPvTGW6
VWrVseKYXpzTjdBLk+AL8NvLQIwgNo0tgvpSeJcncWx0C
ZEztflQrmN5EGuEpKFlpiikfufz74VUjtcF55RXwldXI5
8Vgw5ot4wMfCuMfrha6Hv1i1WaTyPFVGJs9ss3D9NPzc9
+8bKMD/COvgAGwJjFwxXCayy5oDD8NvYr1vyPlUVqO8jV
Aw7Hg/ZJoZM6IJvp/KcM2GQm8Bod1A5YImNLA245hRVm9
EFNnU/e6BrKONu65Q+NG+NvZjWxbyIfJCsjk9TTb11veL
AN1wyZ4o1cuSNlca/jtIkAGNrzp+TwqP7bGh5p6e65vYe
tm8ZdafzFdxtwnDwew2X0MsAciX0rov+szvIK2KNwt3Co
8Kr4dlyv7I+4++JBXHzxcITpxfJRItVGmuxP08xizOtMa
iblzhRCo+49B/jj+ojCCHnOpCtFDXL1iEPTpViOs+dXbv
HBKeNGNZ/gse/tynyV7V5SAAKgpxg0/i4hFdZSYw+7NUM
ObVHQfMlAL3vA43mQk2scEDz+ku2TY8BW63QfHKjMsKjl
oudbOHFwB93PH0RDslonPmPklx8FqX4IboBfnTuHXWtRA
FxC6AW7ke9AMXK7Ok29UYogGUgelypw2mRwyBKLVwf8eg
YLzVXgYXWjo3nslt116Mu+xO4hTS0Hla1Dhb/YzCIYM83
GiRbvL+UIrOnYflXIBkaK7fJqyIR5s99YpzBGVS1j+pgn
FZQ9weuiAPoUoOISFofjA4bCzY1ocpZIAZyGgnoAsYl6C
S++TulpMRX3Ti3ilKenqXQsqfyPgCWA7eO5ztoJQFCoWi
q3nzUTXitFdoyoZy22Zg414HexNGrxFig023DiKI5cX2O
5v/nHot+bu/xVMng1e/tIGXDAFv4fgPopqcl+MScUeyDd
vlWE=
X-MS-Exchange-CrossTenant-Network-Message-Id: 4d6e65b2-78ef-4946-aa9a-08dae351e160
X-MS-Exchange-CrossTenant-AuthSource: AM6PR05MB4997.eurprd05.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 12:50:04.0817 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 54df0b8c-c3e7-4da4-b554-24cf2be8f1dc
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: +pz4QTxgPQlx6ooJhHxI5kLh5HJNZF//4ZZTBlAI5ixKdHTe1pYwH0hYHY6+gInw
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR05MB10121
X-OriginatorOrg: solute.de
X-EsetResult: clean, is OK
X-EsetId: 37303A299561B2566C746A
X-C2ProcessedOrg: 6b8a70a0-c2cb-4e72-a27d-0fc2d5a54e94
X-CrossPremisesHeadersFilteredBySendConnector: solute-exc2019.solute.ka
X-OrganizationHeadersPreserved: solute-exc2019.solute.ka
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <9889d5d4-3a41-4b7c-f709-b1810a09880e@solute.de>
X-Mailman-Original-References: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com>
 by: Lars Liedtke - Wed, 21 Dec 2022 12:50 UTC

Or you could have "native" bash ($SHELL) with WSL. But I assume not everyone is using it.

Cheers

Lars

Lars Liedtke
Software Entwickler

[Tel.] +49 721 98993-
[Fax] +49 721 98993-
[E-Mail] lal@solute.de<mailto:lal@solute.de>

solute GmbH
Zeppelinstraße 15
76185 Karlsruhe
Germany

[Logo Solute]

Marken der solute GmbH | brands of solute GmbH
[Marken]
[Advertising Partner]

Geschäftsführer | Managing Director: Dr. Thilo Gans, Bernd Vermaaten
Webseite | www.solute.de <http://www.solute.de/>
Sitz | Registered Office: Karlsruhe
Registergericht | Register Court: Amtsgericht Mannheim
Registernummer | Register No.: HRB 110579
USt-ID | VAT ID: DE234663798

Informationen zum Datenschutz | Information about privacy policy
https://www.solute.de/ger/datenschutz/grundsaetze-der-datenverarbeitung.php

Am 21.12.22 um 13:15 schrieb Albert-Jan Roskam:

On Dec 21, 2022 06:01, Chris Angelico <rosuav@gmail.com><mailto:rosuav@gmail.com> wrote:

On Wed, 21 Dec 2022 at 15:28, Jach Feng <jfong@ms4.hinet.net><mailto:jfong@ms4.hinet.net> wrote:
> That's what I am taking this path under Windows now, the ultimate
solution before Windows has shell similar to bash:-)

Technically, Windows DOES have a shell similar to bash. It's called
bash. :) The trouble is, most people use cmd.exe instead.

==== I use Git Bash quite a lot: https://gitforwindows.org/
Is that the one you're referring to?

Re: How to enter escape character in a positional string argument from the command line?

<cmd-20221221143358@ram.dialup.fu-berlin.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=25258&group=comp.lang.python#25258

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: How to enter escape character in a positional string argument from the command line?
Date: 21 Dec 2022 13:39:14 GMT
Organization: Stefan Ram
Lines: 47
Expires: 1 Dec 2023 11:59:58 GMT
Message-ID: <cmd-20221221143358@ram.dialup.fu-berlin.de>
References: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com> <9889d5d4-3a41-4b7c-f709-b1810a09880e@solute.de> <mailman.1286.1671627449.20444.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de 13lU6qakJNh6QMcMr96hwgfksOrt+J0OZJwJcat3onQA68
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Wed, 21 Dec 2022 13:39 UTC

Lars Liedtke <lal@solute.de> writes:
>Or you could have "native" bash ($SHELL) with WSL.

In this newsgroup, it would actually be obvious to use Python.
When commands are typed manually, this might be a bit verbose,
though. I mean

os.chdir( r'C:\EXAMPLE' )

versus

CD C:\EXAMPLE

. But whenever one feels like writing a "batch file" for cmd,
"Power Shell" or bash, one could consider to use Python instead.

Then, of course, there "cmd", ...

import os
import cmd

class PythonShell( cmd.Cmd ):

intro = 'Welcome to the Python shell. Type help or ? to list commands.\n'
prompt = '(Python) '
file = None

def do_cd( self, arg ):
'change directory: CD C:\EXAMPLE'
os.chdir( *parse( arg ))

def do_bye( self, arg ):
'Exit: BYE'
print( 'Thank you for using the Python Shell!' )
return True

def precmd(self, line):
line = line.lower()
return line

def parse( arg ):
return tuple( arg.split() )

print( __doc__ )
PythonShell().cmdloop()

Re: How to enter escape character in a positional string argument from the command line?

<mailman.1289.1671639570.20444.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=25262&group=comp.lang.python#25262

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: rosuav@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: How to enter escape character in a positional string argument
from the command line?
Date: Thu, 22 Dec 2022 03:19:18 +1100
Lines: 56
Message-ID: <mailman.1289.1671639570.20444.python-list@python.org>
References: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com>
<9889d5d4-3a41-4b7c-f709-b1810a09880e@solute.de>
<mailman.1286.1671627449.20444.python-list@python.org>
<cmd-20221221143358@ram.dialup.fu-berlin.de>
<CAPTjJmpLfbwVCczJzOGKsEUR9RmT4qd4VUgsCL9JAC=Hkd8h-A@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de w/uYAhEm6slxS7QrAmODiwfq03QclkN4Fob6iC/spbVw==
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=UGPDd4yk;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.004
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'def': 0.04; '2022': 0.05;
'ram': 0.07; 'task.': 0.07; 'python.': 0.08; 'general,': 0.09;
'python"': 0.09; 'though.': 0.09; 'writes:': 0.09; "'change":
0.16; 'bash': 0.16; 'cases,': 0.16; 'chrisa': 0.16; 'crashed':
0.16; 'difficult,': 0.16; 'elsewhere': 0.16; 'from:addr:rosuav':
0.16; 'from:name:chris angelico': 0.16; 'intro': 0.16; 'print(':
0.16; 'received:209.85.218': 0.16; 'semantics': 0.16;
'subject:string': 0.16; 'things,': 0.16; 'wrote:': 0.16; 'python':
0.16; 'thu,': 0.19; 'to:addr:python-list': 0.20; 'language': 0.21;
'languages': 0.22; "what's": 0.22; 'subject:How': 0.23;
'programming': 0.25; 'stefan': 0.26; 'bit': 0.27; 'dec': 0.31;
'saved': 0.31; 'think': 0.32; 'message-id:@mail.gmail.com': 0.32;
'but': 0.32; 'mean': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'from:addr:gmail.com': 0.35;
'subject:from': 0.37; 'really': 0.37; 'using': 0.37; "it's": 0.37;
'received:209.85': 0.37; 'class': 0.37; 'hard': 0.37; 'file':
0.38; 'could': 0.38; 'received:209': 0.39; 'this,': 0.39; 'list':
0.39; 'use': 0.39; 'prompt': 0.39; 'program.': 0.40; 'try': 0.40;
'stay': 0.61; 'true': 0.63; 'ever': 0.63; 'key': 0.64; 'your':
0.64; 'amazing': 0.65; 'less': 0.65; 'that,': 0.67; 'obvious':
0.69; "you'll": 0.73; 'practical': 0.84; 'crucial': 0.84;
'desperately': 0.84; 'exactly.': 0.84; 'outdo': 0.84; 'subject: \n
': 0.84; 'weird': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=j9R/mT++ALbqUJ1U4Od3ERODSf9UHk8Zkc0zgVvlylU=;
b=UGPDd4ykAkmE+2TEbfZnsp2L2GNfItAlgw0LtreoGZkui/yXZ2+GwHhm7ASDQFxk/p
MStZ9hiRh6clfFpx2oieNYEpFbKdpWQaftDca7DEOrkKJhSWcAObT3NmoFnNz0PMgroH
WpqlnUTdL42sa3j/RGYzGVUEf22tjKpl2IyOWSswdr38RvX/SLr0McrjOSzlKcAiGqHq
FNQowyQAeNgGpEXuNDgWcfZK6rBCG7ApMIiLsyAeibTJ5pioAalRXISus9ET5bmWmtAc
fFW6v/HNTSmfxN1ArcrikfW78G994iHI1OqCZRoOz23ARVG0TmlY2MqfgW0UJXEkpopl
F80g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=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=j9R/mT++ALbqUJ1U4Od3ERODSf9UHk8Zkc0zgVvlylU=;
b=X3L1Dy8jVEppph+pU73fn/ATCSAOv2Rrtk1EiSkoNguaJcIs3lgJZDwq0dWe3OOYwK
2vSUCmcycGNJ2yN7eYeu9Q/UeXSvrauTBO8ULJ/d8wdm64wzBLjiHsoRyfdQKAm+334A
KUySZz+C3Pm30SQCghgdu8ulSUAp50QjnNwtmsi2zweUoNL65jUIDNrd9P2i746t7/x0
mzEmnjkX+uczu65n9vfiw1Q9tlmr8wB/+BWxBb/6eYjrfSJPXe1tzbeoVH7xOjc0cS9I
gFBbIEHBnx5G+T22+B57qsh7EsjyvAIc44qQ4uOy7NaBsmvpCLFaCYlURunt5tzKjfDw
0dHw==
X-Gm-Message-State: AFqh2krLzYw3zEy8VEob4DCgOfluGtAQbioObg+WN1st3+oEer1oWuks
p1GFob+1m4R6COZoHmuhWWxEINvH0PtvdEtbIeckhDTc
X-Google-Smtp-Source: AMrXdXvKodbyVCnEFH6EtQ66ZNmjikF9iYureTHYeVlbxbfQYz0TZwgufLpea0BXoDs/lcFmet/EF6N+S9fsbZctEHI=
X-Received: by 2002:a17:907:c302:b0:81b:f6fc:e6d8 with SMTP id
tl2-20020a170907c30200b0081bf6fce6d8mr216900ejc.13.1671639569226; Wed, 21 Dec
2022 08:19:29 -0800 (PST)
In-Reply-To: <cmd-20221221143358@ram.dialup.fu-berlin.de>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAPTjJmpLfbwVCczJzOGKsEUR9RmT4qd4VUgsCL9JAC=Hkd8h-A@mail.gmail.com>
X-Mailman-Original-References: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com>
<9889d5d4-3a41-4b7c-f709-b1810a09880e@solute.de>
<mailman.1286.1671627449.20444.python-list@python.org>
<cmd-20221221143358@ram.dialup.fu-berlin.de>
 by: Chris Angelico - Wed, 21 Dec 2022 16:19 UTC

On Thu, 22 Dec 2022 at 03:11, Stefan Ram <ram@zedat.fu-berlin.de> wrote:
>
> Lars Liedtke <lal@solute.de> writes:
> >Or you could have "native" bash ($SHELL) with WSL.
>
> In this newsgroup, it would actually be obvious to use Python.

Less obvious than you might think - partly because bash is just so
dang good that it's really really hard to outdo it :) Sure, bash has a
lot of weird and wonky edge cases, but it's an incredibly practical
shell to use.

> When commands are typed manually, this might be a bit verbose,
> though. I mean
>
> os.chdir( r'C:\EXAMPLE' )
>
> versus
>
> CD C:\EXAMPLE

Exactly. What's good for a programming language is often not good for a shell.

> class PythonShell( cmd.Cmd ):
>
> intro = 'Welcome to the Python shell. Type help or ? to list commands.\n'
> prompt = '(Python) '
> file = None
>
> def do_cd( self, arg ):
> 'change directory: CD C:\EXAMPLE'
> os.chdir( *parse( arg ))
>
> def do_bye( self, arg ):
> 'Exit: BYE'
> print( 'Thank you for using the Python Shell!' )
> return True

Sure, you can always create your own shell. But I think you'll find
that, as you start expanding on this, you'll end up leaning more
towards "implementing bash-like and/or cmd-like semantics in Python"
rather than "creating a Python shell". Shells, in general, try to
execute programs as easily and conveniently as possible. Programming
languages try to stay inside themselves and do things, with subprocess
spawning being a much less important task.

Fun challenge: see how much you can do in bash without ever forking to
another program. And by "fun", I mean extremely difficult, and by
"challenge" I really mean "something you might have to do when your
system is utterly hosed and all you have available is one root shell".

It's amazing how far you can go when your hard drive has crashed and
you desperately need to get one crucial login key that you thought you
had saved elsewhere but hadn't.

ChrisA

Re: How to enter escape character in a positional string argumentfrom the command line?

<mailman.1290.1671641827.20444.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=25263&group=comp.lang.python#25263

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: gheskett@shentel.net (gene heskett)
Newsgroups: comp.lang.python
Subject: Re: How to enter escape character in a positional string argumentfrom
the command line?
Date: Wed, 21 Dec 2022 11:55:54 -0500
Lines: 75
Message-ID: <mailman.1290.1671641827.20444.python-list@python.org>
References: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com>
<9889d5d4-3a41-4b7c-f709-b1810a09880e@solute.de>
<mailman.1286.1671627449.20444.python-list@python.org>
<cmd-20221221143358@ram.dialup.fu-berlin.de>
<CAPTjJmpLfbwVCczJzOGKsEUR9RmT4qd4VUgsCL9JAC=Hkd8h-A@mail.gmail.com>
<1d7e4fd3-2cdb-e1df-ed18-d2d79b727dc4@shentel.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de ouZxAhm579ek8guOgRSwow4j0RXpkYbO3vC2mSzOwv8g==
Return-Path: <gheskett@shentel.net>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'def': 0.04; '2022': 0.05;
'received:204': 0.05; 'ram': 0.07; 'task.': 0.07; 'python.': 0.08;
'angelico': 0.09; 'general,': 0.09; 'python"': 0.09; 'though.':
0.09; 'writes:': 0.09; 'cheers,': 0.11; '"there': 0.16; "'change":
0.16; '-ed': 0.16; 'ammo.': 0.16; 'ballot,': 0.16; 'bash': 0.16;
'brandeis': 0.16; 'cases"': 0.16; 'cases,': 0.16; 'chrisa': 0.16;
'crashed': 0.16; 'desire': 0.16; 'difficult,': 0.16; 'dotted':
0.16; 'elsewhere': 0.16; 'from:addr:gheskett': 0.16;
'from:addr:shentel.net': 0.16; 'from:name:gene heskett': 0.16;
'genes': 0.16; 'howdershelt': 0.16; 'intro': 0.16; 'jury,': 0.16;
'liberty:': 0.16; 'message-id:@shentel.net': 0.16; 'order."':
0.16; 'print(': 0.16; 'printer.': 0.16; 'received:204.111': 0.16;
'received:204.111.64': 0.16; 'received:204.111.64.149': 0.16;
'respectable.': 0.16; 'semantics': 0.16; 'soap,': 0.16;
'subject:string': 0.16; 'things,': 0.16; 'tree,': 0.16;
'url:6309': 0.16; 'url:geneslinuxbox': 0.16; 'useful.': 0.16;
'wrote:': 0.16; 'python': 0.16; 'thu,': 0.19; 'to:addr:python-
list': 0.20; 'language': 0.21; 'languages': 0.22; "what's": 0.22;
'subject:How': 0.23; 'programming': 0.25; 'cover': 0.26; 'stefan':
0.26; 'bit': 0.27; '>>>': 0.28; 'chris': 0.28; 'printed': 0.28;
'header:User-Agent:1': 0.30; 'dec': 0.31; 'saved': 0.31; 'think':
0.32; 'do.': 0.32; 'but': 0.32; 'mean': 0.34; 'header:In-Reply-
To:1': 0.34; 'respect': 0.35; 'those': 0.36; 'really': 0.37;
'using': 0.37; "it's": 0.37; 'class': 0.37; 'hard': 0.37; 'file':
0.38; 'could': 0.38; 'single': 0.39; 'this,': 0.39; 'list': 0.39;
'use': 0.39; 'prompt': 0.39; 'program.': 0.40; 'try': 0.40;
'should': 0.40; 'four': 0.60; 'law': 0.60; 'stay': 0.61; 'paper':
0.62; 'true': 0.63; 'ever': 0.63; 'copy': 0.63; 'key': 0.64;
'down': 0.64; 'ago.': 0.64; 'your': 0.64; 'amazing': 0.65; 'less':
0.65; 'that,': 0.67; 'url:net': 0.68; 'law,': 0.69; 'obvious':
0.69; 'url-ip:lookup error': 0.70; "you'll": 0.73; 'man': 0.74;
'documented': 0.76; 'dead': 0.81; 'practical': 0.84; '1940)':
0.84; 'crucial': 0.84; 'desperately': 0.84; 'exactly.': 0.84;
'outdo': 0.84; 'received:mail': 0.84; 'subject: \n ': 0.84;
'weird': 0.84
auth-sender: gheskett@shentel.net
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.5.0
Content-Language: en-US
In-Reply-To: <CAPTjJmpLfbwVCczJzOGKsEUR9RmT4qd4VUgsCL9JAC=Hkd8h-A@mail.gmail.com>
X-CTCH-Spam: Unknown
X-CTCH-RefID: str=0001.0A742F1E.63A33A9B.0037, ss=1, re=0.000, recu=0.000,
reip=0.000, cl=1, cld=1, fgs=0
X-OriginalArrivalTime: 21 Dec 2022 16:55:55.0531 (UTC)
FILETIME=[178BA5B0:01D9155D]
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <1d7e4fd3-2cdb-e1df-ed18-d2d79b727dc4@shentel.net>
X-Mailman-Original-References: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com>
<9889d5d4-3a41-4b7c-f709-b1810a09880e@solute.de>
<mailman.1286.1671627449.20444.python-list@python.org>
<cmd-20221221143358@ram.dialup.fu-berlin.de>
<CAPTjJmpLfbwVCczJzOGKsEUR9RmT4qd4VUgsCL9JAC=Hkd8h-A@mail.gmail.com>
 by: gene heskett - Wed, 21 Dec 2022 16:55 UTC

On 12/21/22 11:22, Chris Angelico wrote:
> On Thu, 22 Dec 2022 at 03:11, Stefan Ram <ram@zedat.fu-berlin.de> wrote:
>>
>> Lars Liedtke <lal@solute.de> writes:
>>> Or you could have "native" bash ($SHELL) with WSL.
>>
>> In this newsgroup, it would actually be obvious to use Python.
>
> Less obvious than you might think - partly because bash is just so
> dang good that it's really really hard to outdo it :) Sure, bash has a
> lot of weird and wonky edge cases, but it's an incredibly practical
> shell to use.
>
When you make a statement like that, Chris, you should also note that
every single one of those "wonky edge cases" is documented down to the
last dotted i. Bash's docs will kill a good sized pulp tree, needing
around a ream of paper to print on a duplex printer. I know, I did it
around a decade ago. If you like to write scripts, having a dead tree
copy of the docs at your elbow in incredibly useful. That huge man page
does not cover it like the printed docs do.

>> When commands are typed manually, this might be a bit verbose,
>> though. I mean
>>
>> os.chdir( r'C:\EXAMPLE' )
>>
>> versus
>>
>> CD C:\EXAMPLE
>
> Exactly. What's good for a programming language is often not good for a shell.
>
>> class PythonShell( cmd.Cmd ):
>>
>> intro = 'Welcome to the Python shell. Type help or ? to list commands.\n'
>> prompt = '(Python) '
>> file = None
>>
>> def do_cd( self, arg ):
>> 'change directory: CD C:\EXAMPLE'
>> os.chdir( *parse( arg ))
>>
>> def do_bye( self, arg ):
>> 'Exit: BYE'
>> print( 'Thank you for using the Python Shell!' )
>> return True
>
> Sure, you can always create your own shell. But I think you'll find
> that, as you start expanding on this, you'll end up leaning more
> towards "implementing bash-like and/or cmd-like semantics in Python"
> rather than "creating a Python shell". Shells, in general, try to
> execute programs as easily and conveniently as possible. Programming
> languages try to stay inside themselves and do things, with subprocess
> spawning being a much less important task.
>
> Fun challenge: see how much you can do in bash without ever forking to
> another program. And by "fun", I mean extremely difficult, and by
> "challenge" I really mean "something you might have to do when your
> system is utterly hosed and all you have available is one root shell".
>
> It's amazing how far you can go when your hard drive has crashed and
> you desperately need to get one crucial login key that you thought you
> had saved elsewhere but hadn't.
>
> ChrisA

Cheers, Gene Heskett.
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
- Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/>

Re: How to enter escape character in a positional string argumentfrom the command line?

<mailman.1291.1671642058.20444.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=25264&group=comp.lang.python#25264

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: rosuav@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: How to enter escape character in a positional string argumentfrom
the command line?
Date: Thu, 22 Dec 2022 04:00:44 +1100
Lines: 33
Message-ID: <mailman.1291.1671642058.20444.python-list@python.org>
References: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com>
<9889d5d4-3a41-4b7c-f709-b1810a09880e@solute.de>
<mailman.1286.1671627449.20444.python-list@python.org>
<cmd-20221221143358@ram.dialup.fu-berlin.de>
<CAPTjJmpLfbwVCczJzOGKsEUR9RmT4qd4VUgsCL9JAC=Hkd8h-A@mail.gmail.com>
<1d7e4fd3-2cdb-e1df-ed18-d2d79b727dc4@shentel.net>
<CAPTjJmqySfY-Bq1K7c29330KTFHTjwD=gKkKEcRavYtMU2LZQA@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de Oa73k3VFCWHPlh+p85MFfwyOVlTbXkADdgsM+ajdl6Kw==
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=nSWnhE0/;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.022
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; '2022': 0.05; 'ram': 0.07;
'python.': 0.08; 'angelico': 0.09; 'writes:': 0.09; 'arguments':
0.16; 'bash': 0.16; 'cases"': 0.16; 'cases,': 0.16; 'chrisa':
0.16; 'dotted': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris
angelico': 0.16; 'heskett': 0.16; 'printer.': 0.16;
'received:209.85.218': 0.16; 'subject:string': 0.16; 'things,':
0.16; 'tree,': 0.16; 'useful.': 0.16; 'wrote:': 0.16; 'thu,':
0.19; 'to:addr:python-list': 0.20; 'problem,': 0.22;
'subject:How': 0.23; 'cover': 0.26; 'stefan': 0.26; 'leave': 0.27;
'>>>': 0.28; 'chris': 0.28; 'thinking': 0.28; 'printed': 0.28;
'dec': 0.31; 'think': 0.32; 'do.': 0.32; "wouldn't": 0.32;
'message-id:@mail.gmail.com': 0.32; 'but': 0.32; 'header:In-Reply-
To:1': 0.34; 'received:google.com': 0.34; 'definitely': 0.35;
'yes,': 0.35; 'from:addr:gmail.com': 0.35; 'those': 0.36;
'really': 0.37; "it's": 0.37; 'received:209.85': 0.37; 'hard':
0.37; 'could': 0.38; 'put': 0.38; 'received:209': 0.39; 'single':
0.39; 'use': 0.39; 'true.': 0.40; 'something': 0.40; 'should':
0.40; 'paper': 0.62; 'copy': 0.63; 'down': 0.64; 'ago.': 0.64;
'your': 0.64; 'less': 0.65; 'that,': 0.67; 'obvious': 0.69; 'man':
0.74; 'documented': 0.76; 'dead': 0.81; 'practical': 0.84;
'absolutely': 0.84; 'dependable': 0.84; 'outdo': 0.84; 'subject:
\n ': 0.84; 'weird': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=i0ejwTKZ4KqeB0U0F+IdjAr8YWNSE8UoMv3dv5kkSoc=;
b=nSWnhE0/4naI/uL7tKS9j/1YGjG7m9+4QHcdsT3YEq8gCABis6kntElZYyns8KMSwA
Wts846GWUFzOPi1PifSPylaB8/G4fVfcqKH8t1fiuplYnUUakuSZjg0JFGOAd31v9yW0
0tz+M3bdVhWMEXqH/jgILLczIyPBrZE73/hGsJkXO8cIcSyw6y+pIcBAwwDb98xAJ2pv
nSrzG8GYyzGkEVAADpjBoM87WqdhWVdnYrvfB02xOaQa9J3lq0zvNxP25qnj+crMvXV/
I9Mz4AgM1tqvv+8jVzHH7Gd5Hh5BIVlAKlW8Q2z1ga3XR2H4ilhhEHq8I6O+9PIYmQSo
f9Mw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=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=i0ejwTKZ4KqeB0U0F+IdjAr8YWNSE8UoMv3dv5kkSoc=;
b=lbIZ37zPPH6OVfyZOf+1erykbbia6XSrxD+4W/1bPYTrDopwPd/YFxDUEHYIyJATvv
PMwb/1iVTGCJ0VipClUgDEcpIBEu5C7bfL2mCnhavAPOoNxpEl1w5yFm5GozXbonqdY1
vvFAZFe/C4TL7nMext3a+RGk4CjZ/yPiyzAAfQbFW81FMmeuOughNCR2AqZRocmf+fB9
0UYvGIHVoceenpW/fr+B+nhuvkEzNHjlbSdHvhbC7mb97Q65Sx6U+zqrK41HAZEQkqyq
NnhfcGCyKZRjCG8u7NQr91bWjY0s1gwDSXPOh2j+Wrf1ZS5HJg8L16yGcTOJeDTxeUUz
jP3g==
X-Gm-Message-State: AFqh2kp3ZVTJ5bKePdE0nMUdxY5U2iiM7vAUL7bgBQvrwz0MqRjZyjrP
Jc1Y8QHezbxffvMXiKeUZQvzx5m7QseHm2T32HWbfqM3
X-Google-Smtp-Source: AMrXdXtyDBC1NAKs2edhMr1I+wmRYwRI0VApHvO9Vpn7XhpI4M13HBdivhbdsYnGfrB6+3papfzTJ15oEBAICXpWG5I=
X-Received: by 2002:a17:906:f6d7:b0:7c4:efa5:b1ea with SMTP id
jo23-20020a170906f6d700b007c4efa5b1eamr303718ejb.335.1671642056035; Wed, 21
Dec 2022 09:00:56 -0800 (PST)
In-Reply-To: <1d7e4fd3-2cdb-e1df-ed18-d2d79b727dc4@shentel.net>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAPTjJmqySfY-Bq1K7c29330KTFHTjwD=gKkKEcRavYtMU2LZQA@mail.gmail.com>
X-Mailman-Original-References: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com>
<9889d5d4-3a41-4b7c-f709-b1810a09880e@solute.de>
<mailman.1286.1671627449.20444.python-list@python.org>
<cmd-20221221143358@ram.dialup.fu-berlin.de>
<CAPTjJmpLfbwVCczJzOGKsEUR9RmT4qd4VUgsCL9JAC=Hkd8h-A@mail.gmail.com>
<1d7e4fd3-2cdb-e1df-ed18-d2d79b727dc4@shentel.net>
 by: Chris Angelico - Wed, 21 Dec 2022 17:00 UTC

On Thu, 22 Dec 2022 at 03:58, gene heskett <gheskett@shentel.net> wrote:
>
> On 12/21/22 11:22, Chris Angelico wrote:
> > On Thu, 22 Dec 2022 at 03:11, Stefan Ram <ram@zedat.fu-berlin.de> wrote:
> >>
> >> Lars Liedtke <lal@solute.de> writes:
> >>> Or you could have "native" bash ($SHELL) with WSL.
> >>
> >> In this newsgroup, it would actually be obvious to use Python.
> >
> > Less obvious than you might think - partly because bash is just so
> > dang good that it's really really hard to outdo it :) Sure, bash has a
> > lot of weird and wonky edge cases, but it's an incredibly practical
> > shell to use.
> >
> When you make a statement like that, Chris, you should also note that
> every single one of those "wonky edge cases" is documented down to the
> last dotted i. Bash's docs will kill a good sized pulp tree, needing
> around a ream of paper to print on a duplex printer. I know, I did it
> around a decade ago. If you like to write scripts, having a dead tree
> copy of the docs at your elbow in incredibly useful. That huge man page
> does not cover it like the printed docs do.
>

Oh yes, absolutely true. Its wonkiness is dependable and consistent;
but it is definitely quirky (look at all the different ways to embed
arguments into things, and the ways that $*, $@, "$*, and "$@" behave
when put into variables). Not usually a problem, but it does sometimes
leave you thinking "wow, wouldn't it be easier to just use something
like Python?". And in the complicated cases, yeah, it can be. But in
the simple cases? Bash rocks.

ChrisA

Re: How to enter escape character in a positional string argument from the command line?

<erf6qhd0j5jshreni34q6i74geb4vn0gdo@4ax.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=25266&group=comp.lang.python#25266

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!69.80.99.23.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 21 Dec 2022 17:21:34 +0000
From: wlfraed@ix.netcom.com (Dennis Lee Bieber)
Newsgroups: comp.lang.python
Subject: Re: How to enter escape character in a positional string argument from the command line?
Date: Wed, 21 Dec 2022 12:21:35 -0500
Organization: IISS Elusive Unicorn
Message-ID: <erf6qhd0j5jshreni34q6i74geb4vn0gdo@4ax.com>
References: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com> <9889d5d4-3a41-4b7c-f709-b1810a09880e@solute.de> <mailman.1286.1671627449.20444.python-list@python.org> <cmd-20221221143358@ram.dialup.fu-berlin.de>
User-Agent: ForteAgent/8.00.32.1272
X-No-Archive: Yes
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 30
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-YT9Bx1mW8YnsdkngH3AiDWkr7VRIIaHgZNi+i3umyD4A+1sG5FOxXeA5/BgLYqPOe6fXVq1Q5IGtq76!4ccTa03C2oq3yqfreschEJSQN1KMe+ihI/QbPFYllgaouo08OdOfWvjzmq8HM9qHnBjz4qvC
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Received-Bytes: 2511
 by: Dennis Lee Bieber - Wed, 21 Dec 2022 17:21 UTC

On 21 Dec 2022 13:39:14 GMT, ram@zedat.fu-berlin.de (Stefan Ram) declaimed
the following:

>Lars Liedtke <lal@solute.de> writes:
>>Or you could have "native" bash ($SHELL) with WSL.
>
> In this newsgroup, it would actually be obvious to use Python.
> When commands are typed manually, this might be a bit verbose,
> though. I mean
>
>os.chdir( r'C:\EXAMPLE' )

os.chdir("C:/Example")

is perfectly valid in the Windows API. It is only the command line
processor that requires \ to differentiate from command options.

If that is still too much to enter, I'd recommend one look at REXX...
Any statement that is not parsable as a REXX command is normally sent to
the shell (unless one has specified a different command processor), so...

"CD C:\Example"

(with the quotes) is sufficient. (Hmm I may have to check that -- it may
only CD for the one command, then revert to parent directory)

--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

Re: How to enter escape character in a positional string argumentfrom the command line?

<cicumflex-20221221182233@ram.dialup.fu-berlin.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=25268&group=comp.lang.python#25268

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: How to enter escape character in a positional string argumentfrom the command line?
Date: 21 Dec 2022 17:38:54 GMT
Organization: Stefan Ram
Lines: 73
Expires: 1 Dec 2023 11:59:58 GMT
Message-ID: <cicumflex-20221221182233@ram.dialup.fu-berlin.de>
References: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com> <9889d5d4-3a41-4b7c-f709-b1810a09880e@solute.de> <mailman.1286.1671627449.20444.python-list@python.org> <cmd-20221221143358@ram.dialup.fu-berlin.de> <CAPTjJmpLfbwVCczJzOGKsEUR9RmT4qd4VUgsCL9JAC=Hkd8h-A@mail.gmail.com> <1d7e4fd3-2cdb-e1df-ed18-d2d79b727dc4@shentel.net> <mailman.1290.1671641827.20444.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de HXkPHyg8kfSsk70MNco6QQXkpGm2cLamiQek9xGQ4wTLXY
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Wed, 21 Dec 2022 17:38 UTC

gene heskett <gheskett@shentel.net> writes:
>When you make a statement like that, Chris, you should also note that
>every single one of those "wonky edge cases" is documented down to the
>last dotted i.

The Windows' cmd is wonky too, but not well documented.
For one example: The circumflex "^" can continue a command line.
But when one wants to use a literal circumflex "^" in a cmd
file or in a file name, it has to be escaped in ways that
seem to be quite irregular. This has been documented by
amateurs, but not by Microsoft AFAIK. (Search for "Note that
the phases described below are only a model of how the batch
parser works.".)

Here's a Windows cmd command file I wrote:

ffmpeg -i "source^^.mp4" ^
"target^^^^.mkv"

. The actual source and target file names are supposed to be
"source^^.mp4" and "target^^.mkv", but in the line continuation,
the "^" has to be escaped, while in the first line it has not!

(Ffmpeg is another piece of software with quite complex options.)

The following Windows cmd file creates three files "aa.txt",
"a^a.txt" and "a^^a.txt" with a delay of one minute between
each creation. Then it loops through the directory and prints
some stats about the files. All the fuss with the "SET" command
is only necessary to correctly iterate through files in a
directory in the presence of the possibility that file names
may contain the circumflex "^"! (Warning: The script will
overwrite some files in the directory it is executed in as
indicated by the use of ">" below". The file has been edited
in the newsreader before posting it and was not tested again
after that editing took place.)

echo 11111>aa.txt
timeout 62
echo 222222>a^^a.txt
timeout 62
echo 3333333>a^^^^a.txt

dir *.txt

setlocal enabledelayedexpansion
for /f %%i in ('dir /b *.txt') do (
SET "a=%%i"
SET "b=!a:^=^^!"
call :sub !b!
) goto :eof

:sub
SET "A=%1"
SET "B=%1"
SET "a=%a:^=^^%"
call :suba %A%, %B%
goto :eof

:suba
echo.&echo.
echo The file %1 was created on %~t2 and contains %~z2 bytes.
echo Contents:
type %1
goto :eof

And this script only handles the special character "^".
There may be other characters that also require special
handling. (I wrote the above script after someone asked
in another Newsgroup how to do this.)

Re: How to enter escape character in a positional string argument from the command line?

<REXX-20221221184855@ram.dialup.fu-berlin.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=25269&group=comp.lang.python#25269

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: How to enter escape character in a positional string argument from the command line?
Date: 21 Dec 2022 17:49:35 GMT
Organization: Stefan Ram
Lines: 12
Expires: 1 Dec 2023 11:59:58 GMT
Message-ID: <REXX-20221221184855@ram.dialup.fu-berlin.de>
References: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com> <9889d5d4-3a41-4b7c-f709-b1810a09880e@solute.de> <mailman.1286.1671627449.20444.python-list@python.org> <cmd-20221221143358@ram.dialup.fu-berlin.de> <erf6qhd0j5jshreni34q6i74geb4vn0gdo@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de f5zyyhgH2ae0mdJwu1VPbw56PgxKzGlOmjLhdi4WPp0Stg
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Wed, 21 Dec 2022 17:49 UTC

Dennis Lee Bieber <wlfraed@ix.netcom.com> writes:
> If that is still too much to enter, I'd recommend one look at REXX...
>Any statement that is not parsable as a REXX command is normally sent to
>the shell (unless one has specified a different command processor), so...

I still have vague but fond memories of embedding something
into my texts in the Amiga Cygnus-Ed editor which then would
serve as Cygnus-Ed "macros" activated via hotkeys. I believe
these snippets were written by me in AREXX (REXX for the Amiga,
1987 by William S. Hawes). I forgot all details, though.

Re: How to enter escape character in a positional string argumentfrom the command line?

<Python-20221221190818@ram.dialup.fu-berlin.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=25271&group=comp.lang.python#25271

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: How to enter escape character in a positional string argumentfrom the command line?
Date: 21 Dec 2022 18:11:13 GMT
Organization: Stefan Ram
Lines: 53
Expires: 1 Dec 2023 11:59:58 GMT
Message-ID: <Python-20221221190818@ram.dialup.fu-berlin.de>
References: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com> <9889d5d4-3a41-4b7c-f709-b1810a09880e@solute.de> <mailman.1286.1671627449.20444.python-list@python.org> <cmd-20221221143358@ram.dialup.fu-berlin.de> <CAPTjJmpLfbwVCczJzOGKsEUR9RmT4qd4VUgsCL9JAC=Hkd8h-A@mail.gmail.com> <1d7e4fd3-2cdb-e1df-ed18-d2d79b727dc4@shentel.net> <mailman.1290.1671641827.20444.python-list@python.org> <cicumflex-20221221182233@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de EzSQV0A5pPRplayYj5jrNwMCwRMSLTgLNaMWee06U0MGO6
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Wed, 21 Dec 2022 18:11 UTC

ram@zedat.fu-berlin.de (Stefan Ram) writes:
>echo 11111>aa.txt
>timeout 62
>echo 222222>a^^a.txt
>timeout 62
>echo 3333333>a^^^^a.txt
>
>dir *.txt
>
>setlocal enabledelayedexpansion
>for /f %%i in ('dir /b *.txt') do (
>SET "a=%%i"
>SET "b=!a:^=^^!"
>call :sub !b!
>)
>goto :eof
>
>:sub
>SET "A=%1"
>SET "B=%1"
>SET "a=%a:^=^^%"
>call :suba %A%, %B%
>goto :eof
>
>:suba
>echo.&echo.
>echo The file %1 was created on %~t2 and contains %~z2 bytes.
>echo Contents:
>type %1
>goto :eof

A similar Python script might be longer, but it deals with
getting the job done and not with fighting irregularities.
(Warning: This script may create/overwrite/delete files!)

import datetime
import pathlib
import time

for content, name in\
( ( '11111', 'aa.txt' ),( '222222', 'a^a.txt' ), ( '3333333', 'a^^a' )):
with open( name, "w" ) as stream:
print( content, file=stream )
time.sleep( 62 )

for file in pathlib.Path.cwd().glob( '*.txt' ):
print( 'The file '+ str( file )+' was created on '+
str( datetime.datetime.fromtimestamp( file.stat().st_ctime ))+
' and contains '+ str( file.stat().st_size )+' Bytes. ' )
print( 'Contents:' )
with open( file, 'r' )as stream: print( stream.read() )

Re: How to enter escape character in a positional string argument from the command line?

<69f7qh1qglup7gdem1o7n05ss6alcka2b8@4ax.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=25274&group=comp.lang.python#25274

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 22 Dec 2022 02:18:07 +0000
From: wlfraed@ix.netcom.com (Dennis Lee Bieber)
Newsgroups: comp.lang.python
Subject: Re: How to enter escape character in a positional string argument from the command line?
Date: Wed, 21 Dec 2022 21:18:07 -0500
Organization: IISS Elusive Unicorn
Message-ID: <69f7qh1qglup7gdem1o7n05ss6alcka2b8@4ax.com>
References: <DB6PR01MB3895C71E48173D3AE6993D5883EB9@DB6PR01MB3895.eurprd01.prod.exchangelabs.com> <9889d5d4-3a41-4b7c-f709-b1810a09880e@solute.de> <mailman.1286.1671627449.20444.python-list@python.org> <cmd-20221221143358@ram.dialup.fu-berlin.de> <erf6qhd0j5jshreni34q6i74geb4vn0gdo@4ax.com> <REXX-20221221184855@ram.dialup.fu-berlin.de>
User-Agent: ForteAgent/8.00.32.1272
X-No-Archive: Yes
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 26
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-FhsghvMn07Bwq5t0xWxYFmZBXaX0rgG9jNY2HjnPGfaLBE1bIACYx5m2lGk5UA0Fv86mJkvtkWptynm!QHABlhU1XE+1N6mWeBYblH5fSnDDmFO628N+7KNa8As3X1iT17uAzbAcby4v5T/8fAFiFbIG
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: Dennis Lee Bieber - Thu, 22 Dec 2022 02:18 UTC

On 21 Dec 2022 17:49:35 GMT, ram@zedat.fu-berlin.de (Stefan Ram) declaimed
the following:

>Dennis Lee Bieber <wlfraed@ix.netcom.com> writes:
>> If that is still too much to enter, I'd recommend one look at REXX...
>>Any statement that is not parsable as a REXX command is normally sent to
>>the shell (unless one has specified a different command processor), so...
>
> I still have vague but fond memories of embedding something
> into my texts in the Amiga Cygnus-Ed editor which then would
> serve as Cygnus-Ed "macros" activated via hotkeys. I believe
> these snippets were written by me in AREXX (REXX for the Amiga,
> 1987 by William S. Hawes). I forgot all details, though.
>
Probably -- AREXX was the most capable version of REXX I've encountered
(Regina REXX and ooREXX seem to be limited in the command processors it
understands -- basically the equivalent of direct execution ["exec"? style]
or with a shell). It allowed /any/ application that opened an AREXX port to
be command processor. Even the basic text editor could be controlled via
AREXX. Heck, one could even write AREXX scripts that could open ports and
become command processors for other scripts.

--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/


devel / comp.lang.python / Re: How to enter escape character in a positional string argument from the command line?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor