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:
Code:
mkdir XXX && cd XXX
If I type these two commands separately, after the mkdir I would type cd <alt-.><Enter>.
Or I could do
Code:
mydir=XXX mkdir $mydir && cd $mydir
but that is more typing than I want.
The second use case is similar:
Code:
chmod +x XXX && mv XXX bin
Same deal.
Ideally, I would like to type something like
Code:
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?
Thanks,
Nick