Skip to content

Tag: escaping

Bash escape character

I have this very reduced example of a bash command, where I want the $ sign escaped. So the command : should print out: a simple $test does not work unfortunately. I tried lots of other stuff but still couldn’t find a solution. Any suggestions ? Answer Put it in single quotes rather than double quotes. …

Sed with special caracters

How can I replace this with sed ? I need to replace this: to Please note that I can’t sed the enabled to disabled because it’s not only used at this location in the input file. I tried this but it didn’t change anything but gave me no error: Answer You can just use the following sed command:…

Using a shell commands in c++

Here’s a terminal command: Here’s my code: The above code, when run, returns this message: How can I place the ‘/’ symbol, for this command to work correctly? Answer Your problem is not in C++. You are invoking your command with popen, and popen runs your command in sh shell, that does…

Is space considered a metacharacter in Bash?

I have searched for the list of metacharacters in Bash but space is not enlisted. I wonder if I’m right by assuming that space is the “token separation character” in Bash, since it not only works as such with Shell programs or builtins but also when creating an array through compound assignm…