Wednesday 23 November 2016

Replace Backquotes with Brackets for Command Substitution

If there is a script which has got backquotes around some commands to assign them to a variable, it can be useful to replace the backquotes with the easier to read but less portable $(...).
ie if you have the following piece of code:
currdir=`pwd`
and want to replace it with
currdir=$(pwd)
then, in Notepad++ use the following in the find and replace menu:
Find: `(.*)`
Replace: \$\($1\)

No comments :

Post a Comment