I'm looking for something similar to an event designator, but not for history. I'm wondering if it's possible for the current command that isn't in history yet.
Examples using event designators in history:
Code:
# cp ~/file /longer/path/name/newfile
# ls -l !cp:2
ls -l /longer/path/name/newfile
or
Code:
# cat /path/to/some/file
# ^cat^rm^
rm /path/to /some/file
What I would like know is if you can do something like:
Code:
# cp /path/to/some/file [$foo].new
Where [$foo] references the second "string" in the line which would be "/path/to/some/file". The actual command used here is irrelevant, I know rename of several other equivalents could be used in this example. I've read through the man page for BASH, but I don't even know what to call what I'm looking for.
Anyone have any ideas?