All Questions
3
questions
4
votes
4
answers
18k
views
Bash converting path names for sed so they escape [duplicate]
I'm having a problem with a script. It is meant to change a value in a file called %DIR% so that it becomes a path name. The problem is the slashes in the directory name upset sed, so I get weird ...
1
vote
1
answer
5k
views
Using sed to replace a string with special chars with another string with special characters
I'm trying to automate switching out a bash prompt for another in .bashrc
Original String:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
...
2
votes
4
answers
10k
views
Appending a string containing escape character with sed
Currently I use:
sed -i -e "5a\\
${text}" $filename
to append something to a certain line, where the variable text
contains a string such as "\epsilon".
When using
echo -E $text
the string is ...