Using lists on the bash command line, is there a way to reference a parameter appearing earlier in the command list?
For example, I have two common use cases:
mkdir XXX && cd XXX
If I type these two commands separately, after the mkdir I would type cd <alt-.><Enter>.
Or I could do
mydir=XXX mkdir $mydir && cd $mydir
but that is more typing than I want.
The second use case is similar:
chmod +x XXX && mv XXX bin
Ideally, I would like to type something like
chmod +x XXX && mv <alt-2> bin
where readline would dereference alt-2 to the third word in the first command.
Is there such a feature in readline?