Answer the question
In order to leave comments, you need to log in
How to implement escaping slashes for ex?
Good day!
The problem is the following - you need to replace the string 'usr/local' in the file with a variable (another way), while the search template and the replacement template need to be changed (if I understand correctly) - escape the slashes, here is my code:
#!/bin/bash
BASEDIR=$(cd "$(dirname "$0")"; pwd)
FIND='/usr/local'
REPLACE=$BASEDIR/php
ex -vc '%s/$FIND/$REPLACE/g|x' $BASEDIR/Makefile
Answer the question
In order to leave comments, you need to log in
For this, I used sed, but the essence is the same. For gray hair, the expression will look like this:
And, correctly noted, slashes must be escaped, i.e.FIND='\/usr\/local'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question