From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19040 invoked from network); 28 Sep 2021 00:42:56 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 28 Sep 2021 00:42:56 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1632789776; b=GmI8TJHjQtYuGyjyQuPgf+8Hi+jpYquhpjpWeDnSUSm5yRLC65Z93idSbRKPh1S7bmvUU99HVB CoLFfijBciyBC7nPLrF3SOulpf0oUXcP/glmIlnruAmYZ84Wh/VoFfoKe8cLuS6+3hzxRED0gb JAZZZqAuxr+ecDb217CUe6ZZ+VL6i7jo1xsSNtZO6fZaTnOmPHBZYQFooZfmO/K1nklw1beS6X a8NC1AlU2i9bqlimKqfsrkiW+DVo6rF7k5yPAZc1AtJb4a5dOLqHY5hng2ccQFsKo6T1Z1i94u SdmYzIdjvutDx7XZx4EMCm3m8Hjkn8FSKHCeMD+EA9zyeg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f169.google.com) smtp.remote-ip=209.85.219.169; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1632789776; bh=NQSiwTm6/wN8bBlUmUVSxiqxAMocxxmmBGtzo8P/9oE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=prOCloh3mooARsYU+pdzOaFvpRKHZykIcNEl4GvT2rgMNft57jGX4d4qWXfPd11KzD+ExHoQCF IUqNyXzodp3jCD30lm8L6aOi/AHGpj9JFIegh373kW373Zb0i67iwR23CXE+4dimGljxwp+FqF 7cvqBeEfmrRW1266Clw+VgKRVStSVFLoc1PVoAqGfKZXxChLpRs/XmRAtofe/Yu3d3zIHMIqFt F0Hf/wbA4S9KgvYORPVJjVl0kZvV/TKZvTw558o/lrWp6RwAIrFlkJHzKtl8xHhWoSwdbudN93 XKbP1B8lBeOk0ty1oLtJZWQOJJuP5si9MuByqJbzh9juUA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=LOPv0vEg7+JnPrUze0nerMahQQDSsBxgCjNCUPyRxbA=; b=lX0jP1vZNaePSwZ6nZQDqZC8vF LjVa7TaanXj3vHTPQEQnr0eoTdlHQDJ1Z2RbCU3Rn5CESX7Ozu8qCPz94EBa1rBcXD1To4vOKafdr W1vKzD6RuBeDkPwnDeJgjkrxxtnnas4DKZ6YbuoUVXc3hBrN+YOiXUeBg+c3IrXdtA20krTuYFpCU mw++SAGdootEOTmb4GN7AZBJ8UT+f+YBCJh7P/M8ETRK8KndX5eHlnRanFFaQLFfJ/cgTndGJw7Qw Rf13N6JCdK/AVhUzH6jwCpwVKaPfCSzS3FqC0yD52wRgoUQyHrac5SsEzdkYjRF9OmRGQ6IOF4mZ9 CpzORbFg==; Received: from authenticated user by zero.zsh.org with local id 1mV1Cw-000IKZ-SQ; Tue, 28 Sep 2021 00:42:55 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f169.google.com) smtp.remote-ip=209.85.219.169; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-yb1-f169.google.com ([209.85.219.169]:33591) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mV1CG-000Hbn-7F; Tue, 28 Sep 2021 00:42:13 +0000 Received: by mail-yb1-f169.google.com with SMTP id s18so13495129ybc.0 for ; Mon, 27 Sep 2021 17:42:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=LOPv0vEg7+JnPrUze0nerMahQQDSsBxgCjNCUPyRxbA=; b=gJNIv2gk3MFQf/l4YNU8rT0dwTfxlA4VG5VLB1wbdBHg4hLVLIQAZ7Z9OQtEDTC3Lr p5TLOqdRmWOUOAWVXs5Vfe+WFLGO+IeVVsUfN3Dmsuv8UZVu+S5K9Dw5D2AqSD9CFJDv HfGEbZ+oX3uW/vMG9b0Q+GXGhUbwdM+3Fnsu0ZY0G/WzCSIFg0vZUn7XvMhRj4DSnVpP CqrLNNajyaC9PyM3rpz2BOyHrmHHUw4xdI00NsmHqLHvKzUo1Brw34hTuYdyTRsjpM4s 60/GZpSGl02ZyR8A1ij6QIC3ntMHBuvIVwmyZsfHaimZNGGVKCcFb9i/P1OMqWFR6zM5 HTNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=LOPv0vEg7+JnPrUze0nerMahQQDSsBxgCjNCUPyRxbA=; b=doLiLoQRFilDbcdG4sHiNrT2+g9kz4HxdftSdqelcwwyu04W6pi4I7OlVNyLqBEO/b 8E5YRHpg9htgCkDL/WiIgb/cF0g6z0lKwBmHYQJRaGdM1NA3LqarvUqri4oTm6wXLf0z tJnI/kzot65s53IbcRM7gHM9B4mPDSvPI3HJd/yKyxsp2KQkKKu51oEUXLlW0iXwQJVR py5Qzv+XeFswE/fh49kKDr2FZaf0IqVYyTbyjJ1V5m9ZiyKO7pcvLcJqgMx9R8S2qXIk sK2XHTrweOYJFSapqbCPGsUfYXCvrsQ0a8oPbDQxgG0bLqd1dUWHEEb2tB8On1g2yTSk CFgg== X-Gm-Message-State: AOAM533l3EqLlvaVyy0Yeqn5WGgYQqj7RhFrlCmb2frno+yaZpfuMS1k wIMxqu4gijadOsiZfxWgMf1F4CNX/cNoRU4Yb3mx+g== X-Google-Smtp-Source: ABdhPJxPpiC3DeI9OAcsq8K5hOfzRcthbEIXB7Wel0ud4D1NejQDCYCR8bx6JKQw9S5gBPV1NZmEPArmLhCLGuNr/R4= X-Received: by 2002:a25:bb93:: with SMTP id y19mr3492170ybg.266.1632789730968; Mon, 27 Sep 2021 17:42:10 -0700 (PDT) MIME-Version: 1.0 References: <20210927233143.GA16620@gmx.de> In-Reply-To: <20210927233143.GA16620@gmx.de> From: Bart Schaefer Date: Mon, 27 Sep 2021 17:41:59 -0700 Message-ID: Subject: Re: less with subprocess To: dominik.vogt@gmx.de, Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 27153 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Mon, Sep 27, 2021 at 4:33 PM Dominik Vogt wrote: > > alias -g LF="> $HOME/tmp/less-input.$$ & less $HOME/tmp/less-input.$$; kill %; rm $HOME/tmp/less-input.$$" Nice, but how about: alias -g LF='| () { cat >$1 &! less $1 ; kill $! } =(:)' The use of &! silently backgrounds and disassociates cat so that it can't be terminal-interrupted, and the anonymous function re-uses the automatically created (and automatically removed) file name from =(:). When less exits, "kill $!" terminates cat. > (You really want to use a private path for the tempfiles > because the alias would be vulnerable to symlink attacks when used > in a publicly writeable directory.) Not unreasonable advice, but using the =(...) substitution removes much of the danger (and most people aren't on shared servers any more). If paranoid, TMPPREFIX can be set to a private path to assure you're always using it with process substitutions.