Sed error "unterminated 's' command" troubleshooting

I am creating a script that, among other things, will replace the template in the XML file with the folder path.

The command sedI'm trying to use is:

SEDCMD="s|PATHTOEXPORT|$2|"

where $2is the command line parameter in which there is a path to the folder.

This is later called:

sed -e $SEDCMD $FILTER > $TEMPFILTER

However, when I run the command, I get an "unterminated" error message.

How can I get around this? I tried to change the characters used to separate the regular expression (from /to |). And I tried to specify (in different ways) a command line parameter.

+3
source share
1

$SEDCMD. script, Makefile, . , .

sed -e "$SEDCMD" "$FILTER" > "$TEMPFILTER"

, $FILTER $TEMPFILTER ? , , ; , , , . rename 's/\s+/_/g' , , ; , ..

-x / -v , , , , , .

+5

Source: https://habr.com/ru/post/1772491/


All Articles