0

Forgive what must be a stupid question, I swear I did try googling it first.

I have a number of commands I'm regularly writing where I'll have a resource name in the middle of the call and find myself always wanting to rerun the command but change the resource I run it against. I'll ctrl-r to bring up the last command, but then I need to move to wherever the resource is to change it. I'm wondering if there is a simple way to move that resource value to the start or end of the command so it's quicker to remove and replace it.

By simple I mean something like tossing a quick grep in. If it takes a bunch of bash scripting or complex sed commands then it's too complicated to be worth the effort since I'm only trying to save a few seconds hunting down where the string is to replace it. But is there a quick way I could tweak commands like this to get the value I want at start/end of the line?

dsollen
  • 804
  • 1
  • 12
  • 25
  • 1
    `M-b` (Alt+b) and `M-f` (Alt+f) keystrokes may help. – Kamil Maciorowski Jan 19 '23 at 16:07
  • @KamilMaciorowski ohh I didn't know them and they do make things easier. though alt b is a bit awkward since it needs both hands and I might have one hand on a mouse to copy/paste. Still I'll try to start using them when bashing (that's a word if I say it is right?) – dsollen Jan 19 '23 at 16:25
  • Does [How to pass parameters to an alias?](https://unix.stackexchange.com/q/3773/100397) answer your question? – roaima Jan 19 '23 at 18:59

0 Answers0