escaping symbolic characters in strings programmatically (zsh)

13 views Asked by At

I am finding that certain characters need to escaped when run through commands.

For example

If I have a command

command "/Users/blah/abcd[1]"

This doesnt work

If I escape the command and run it as

command "/Users/blah/abcd\[1\]"

it works.

However, I have files with 100s of lines containing lines like this ""/Users/blah/abcd[1]""

While I can replace "[" with "[" and "]" with "]", is there a better way to do this?

I have tried escaping the individual characters, but its very laborious and errorprone.

0

There are 0 answers