Re-Use A Bash Command With Different Parameters
Suppose you have typed and executed this command in your Linux shell:
1 | ./script_a.sh 1.23 && ./script_b.sh 1.23 && ./script_c.sh 1.23.45 |
Now you want to run the same command, but with 2.34 instead of 1.23
A nice way to do it is this:
1 | !!:gs/1.23/2.34 |
Meaning, run the last command (!! is also called ‘bang bang’, and it’s substituted by the last command you executed), and replace every instance of 1.23 by 2.34
via Unix Bash Scripting.
Have fun
Related posts:
Leave a Reply
About Me
Tags
Bash
Collaboration
Command Line Interface
Courses
Debug
Ebooks
Email
Facebook
Firefox
Google
Hardware
History
Illusions
Linux
Linux Development
Macros
Manpages
Multimedia
Networks
Object Oriented Programming
Off-Topic
Open Knowledge
Operating Systems
Productivity
Programming
Religion
Science
Security
sed
Sharing
Shell Scripts
Short Posts
Small Code
Social Media
Studies
Technology
Terminal
Thoughts
TIps
Tools
University
Vim
Web Development
Web Services
Websites
Categories
- Algorithms
- Bash
- BlackBerry
- Collaboration
- Command Line
- Cool Tricks
- Easter Eggs
- Ebooks
- Firefox
- Hardware
- Humor
- iPhone
- Linux
- Linux Development
- Linux Kernel
- Networks
- Open Knowledge
- Other
- Productivity
- Programming
- Regular Expressions
- Science
- Security
- Shell Scripts
- Short Posts
- Social Networks
- Thoughts
- Tools
- Vim
- Web Development
- Websites
Popular Posts
Calendar
Archives
- July 2010 (5)
- June 2010 (1)
- May 2010 (1)
- April 2010 (3)
- March 2010 (1)
- January 2010 (1)
- December 2009 (2)
- September 2009 (13)
- July 2009 (1)
- June 2009 (6)
- May 2009 (4)
- March 2009 (18)
- February 2009 (10)
- January 2009 (10)
- December 2008 (7)
- November 2008 (8)
- October 2008 (1)
- August 2008 (1)
- July 2008 (1)
- June 2008 (2)
