I have the following in my .bashrc file I use for a log:
function log(){
RED="\e[0;31m"
RESET="\e[0m"
echo -e "${RED}$(date)" "${RESET}$*" >> "$HOME"/mylog.txt
}
But when I do something with an apostrophe in it, it comes up with some sort of prompt and does not log it properly.
How do I escape all the text being input into the file?
Example:
$ log this is a testing's post
> hello
>
> ^C
$
Thanks.