From: zzapper <zsh@rayninfo.co.uk>
To: zsh-users@zsh.org
Subject: Re: automatically turn previous command into an alias
Date: Tue, 30 Aug 2022 14:26:37 +0100 [thread overview]
Message-ID: <7c60f5da-8ec7-0ae1-040a-9a8c0c901a83@rayninfo.co.uk> (raw)
In-Reply-To: <d5401f18-927b-99a4-5cef-470edaf4385a@gmx.com>
On 30/08/2022 14:04, Eric Cook wrote:
> On 8/30/22 04:02, zzapper wrote:
>>
>> # automatically turn previous command into an alias
>>
>>> alias mkal='_f(){_al=$(history -n -1 -1 | sed "s#\\\\n##" ); alias
>>> $1="$_al" ; alias -L "$1"};_f'
>>
>>
>>
>> any improvements, easier way etc
>>
>
> aliases_suck() {
> aliases[${1:?no name given}]=$history[$((HISTCMD-1))]
> alias -L $1
> }
>
I really like your elegant solution. My lingering preference for aliases
is that they are so easy to tab expand and tweek
zzapper
prev parent reply other threads:[~2022-08-30 13:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-30 8:02 zzapper
2022-08-30 13:04 ` Eric Cook
2022-08-30 13:26 ` zzapper [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7c60f5da-8ec7-0ae1-040a-9a8c0c901a83@rayninfo.co.uk \
--to=zsh@rayninfo.co.uk \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).