New answers tagged escape-characters
You need to look at the character before the percent. sed 's/\([^\\]\)%.*/\1/' If the previous character is not a backslash, keep that char and remove the rest. This answer assumes that the % does not appear at the beginning of the line. If it does, then we need to check for it sed 's/\(^\|[^\\]\)%.*/\1/'
To delete the ASCII ESC character use: tr -d '\033' <infile >outfile
In a command substitution delimited with $(…), what's inside the parentheses is parsed in the same way as a toplevel command (except in a few corner cases involving unbalanced closing parentheses). What's inside the parentheses is an ordinary shell snippet, there's no additional backslash expansion being done. The command echo '\\' prints three characters: ...
It has more to do with quoting, $ echo '\' \ $ echo '\\' \\ $ echo "\\" \ With single quotes, whatever is there between quotes is echoed. With double quotes, the shell looks inside and does processing.
I think it's best understood by the output of echo $(echo '\\') (i.e. a variant without the outer quotes), which results in \\. The point is that there's no literal string interpretation of the backslash(es) when the command substitution entity $(...) is expanded. (This is similar in case you have escape characters stored in strings; there won't be a ...
First run sudo modprobe pcspkr and then beep should work. The reason this doesn't is because by default Ubuntu no longer loads the hardware driver that produce beeps. EDIT This should work on Mint as well, ignore my Ubuntu comment. I am partial as that is what I have been on for so long Some other items I have come across- sudo xset b on echo ...
Top 50 recent answers are included