Sample Header Ad - 728x90

How to write script prefix braces with backslashes

-1 votes
3 answers
167 views
I already posted add escape character with bash . I need script to this for every line in a file that starts with {@codeBlock so {@codeBlock: TEstBigquerry.buildPicks} should look like \{@codeBlock:\ TEstBigquerry.buildPicks\} My script #!/bin/bash file=clfields.mdx while read -r line; do if [[ "${line::11}" == '{@codeBlock' ]]; then printf '%q\n' "$line" else echo "$line" fi done < clfields.mdx Terminal output is ok but the file stays the same. Why?
Asked by MikiBelavista (1755 rep)
Nov 20, 2024, 05:01 PM
Last activity: Nov 22, 2024, 05:39 PM