string1-string2-string3 Verified current stable Not installed? Filesystem

String1 String2 String3 / Replace String In Previous Command Add To End

Replace String In Previous Command Add To End

Modifies the last command to replace a specified string and append a new string.

$
Terminal
^<string1>^<string2>^<string3>

When To Use

In scenarios where downstream arguments need to be altered while retaining context.

Pro Tip

Use '!!^' to modify the first token only, allowing flexibility in the command structure.

Anatomy of Output

Understanding the result

Updated command: echo 'NewString' Final Command

Shows the result after modification.

NewString Output

Actual output produced by the command.

Success: Command executed Status Message

Indicates successful execution.

Troubleshooting

Common pitfalls

bash: string1: command not found

Solution: Verify the original command syntax.

bash: new argument expected

Solution: Ensure correct formatting: replace with valid arguments.

No previous command found

Solution: Run an initial command before attempting substitution.

Command Breakdown

What each part is doing

^<string1>^<string2>^<string3>
Base Command
The executable that performs this operation. Here it runs String1 String2 String3 before the shell applies any redirect operators.
<string1>
string1
The value supplied for string1.
<string2>
string2
The value supplied for string2.
<string3>
string3
The value supplied for string3.

Alternative Approaches

Comparable commands in other tools

Alternative filesystem tools for the same job.