From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <9front-bounces@9front.inri.net> X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: from 9front.inri.net (9front.inri.net [168.235.81.73]) by inbox.vuxu.org (Postfix) with ESMTP id B540E25FBF for ; Sat, 6 Jul 2024 11:43:36 +0200 (CEST) Received: from pb-smtp20.pobox.com ([173.228.157.52]) by 9front; Sat Jul 6 05:41:28 -0400 2024 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 963B123C8A for <9front@9front.org>; Sat, 6 Jul 2024 05:41:26 -0400 (EDT) (envelope-from me+unobe@fallglow.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=message-id :date:from:to:subject:in-reply-to:mime-version:content-type :content-transfer-encoding; s=sasl; bh=Aj45a/L84dlZPzR3UKt1ZE3Vy HuiNo/fJrGBiu9jiY8=; b=xL5dXuj7MNzdGe7hX6lpvcXVoa22jEsRtDJhHPb98 j5qOgqd87kmISBV4VfykO7BO/fBH5dr0BDEFVSG/uJqtaJ7y78Mv3MkrP22l3z8s p9fK/EriVUkyzVeSrELLz1gPrQKMuB6OrdYel+tPk7r50QQUS4tpyy1xbkc40bet Wg= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 81D3A23C89 for <9front@9front.org>; Sat, 6 Jul 2024 05:41:26 -0400 (EDT) (envelope-from me+unobe@fallglow.com) Received: from strider.localdomain (unknown [97.131.57.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id 812D423C88 for <9front@9front.org>; Sat, 6 Jul 2024 05:41:22 -0400 (EDT) (envelope-from me+unobe@fallglow.com) Message-ID: <9B97890FFC11EBEF9081B4D16E0DB78D@smtp.pobox.com> Date: Sat, 06 Jul 2024 02:41:20 -0700 From: Romano To: 9front@9front.org In-Reply-To: <217ca7f7-6c1d-4f6e-9c71-696c463ff24d@sirjofri.de> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Pobox-Relay-ID: E7B54386-3B7B-11EF-985D-C38742FD603B-09620299!pb-smtp20.pobox.com Content-Transfer-Encoding: quoted-printable List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: extension realtime-java interface Subject: Re: [9front] Re: /bin/"" use of rc -c instead of eval Reply-To: 9front@9front.org Precedence: bulk On Sat Jul 6 01:04:30 -0700 2024, sirjofri+ml-9front@sirjofri.de wrote: > 06.07.2024 03:49:46 Romano : > > cpu% pwd > > / > > cpu% "" cd /sys > > =C2=A0=C2=A0=C2=A0=C2=A0 cpu% cd /sys/src > > cpu% pwd > > /sys/src > > cpu% >=20 > That's not how it's supposed to work though. Let me illustrate: >=20 > > cpu% pwd > > /sys/src > > cpu% " > >=C2=A0=C2=A0=C2=A0=C2=A0 cpu% pwd > > cpu% "" > >=C2=A0=C2=A0=C2=A0=C2=A0 cpu% pwd > > /sys/src > > cpu% >=20 > " only displays the last command while "" executes it. An optional argu= ment can be used for filtering: >=20 > > cpu% pwd > > /sys/src > > cpu% cd /lib > > cpu% "" p > >=C2=A0=C2=A0=C2=A0=C2=A0 cpu% pwd > > /lib > > cpu% >=20 Maybe I did not give enough context in my reply: I know that " lists *previous* commands and "" executes them. So 'cd /sys/src' was something I had previously run in that window. Here's a comparison of the current "" functionality: |cpu% cd /sys/src |cpu% cd /sys |cpu% pwd |/sys |cpu% " cd | cpu% cd /sys/src | cpu% cd /sys |cpu% "" cd.*src | cpu% cd /sys/src |cpu% pwd |/sys |cpu%=20 And here it is using "" as a fn with eval: |cpu% fn "" { | PROMPT=3D'[^ ]*(%|;)+[ ]+' | _x=3D`{ | " $*|tail -1 | } | if(~ $#_x 0){ | >[1=3D2]echo no such command found | exit notfound | } | >[1=3D2]echo ' ' $_x | _x=3D`{ | echo -n 'eval '''; echo $_x|sed 's/^'^$PROMPT^'//; s/''/''''/g; s/$/'= '/' | } | eval $"_x | } |cpu% cd /sys/src |cpu% cd /sys |cpu% pwd |/sys |cpu% " cd | cpu% cd /sys/src | cpu% cd /sys |cpu% "" cd.*src | cpu% cd /sys/src |cpu% pwd |/sys/src |cpu%=20 Did you think I was saying it worked differently? My main point is that built-in rc commands don't like other commands with "". That is, even tho' it'll happily print out the cd command, it has no effect in the shell since it's run in a subshell. The most I could do is then copy-and- paste if I wanted to use it. AFAICT a handful would really make a difference with the fn-form of "": cd, eval, flag, fn, and '.'. > Note that I never tested cd'ing with "", which means a lot. It's probab= ly not as useful in most cases, which makes sense if you think about it: = you use cd to switch to another directory. When you're there, running it = again is a no-op at best, or it fails. Switching back and forth between different directories is a common occurrence during development for me, so I wanted something akin to bash-like 'cd -' or '^R cd' without having to use the mouse.