Under sh or bash, can anyone tell me why this resorts to my second prompt?Code:echo 'Don\'t tell me this doesn\'t work'
Printable View
Under sh or bash, can anyone tell me why this resorts to my second prompt?Code:echo 'Don\'t tell me this doesn\'t work'
Within single quotes, _nothing_ except the ending quote is recognized, not even backslash. Therefore, to accomplish that, you must use this:
Code:echo 'Don'\'' tell me this doesn'\''t work'
Hmm. I guess I better e-mail the author of this book. One of her examples does exactly what I wrote before.
I'm absolutely not sure, but I have a faint memory that I actually have used that technique before, in an older version of bash, so maybe they have deleted that functionality after the book was released. I might very well remember it all wrong, though. Try mailing her; she might know the truth behind it.
I was doing this kind of thing in RedHat 7.3 and I don't recall this giving me a problem. Of course I was using bash instead of ash at the time (since I never installed sh) but don't recall it giving me a problem. Now in Debian, it doens't work in ash 0.3.8-7 or bash 2.05a-11. Eitherway, I e-mailed the author and hopefully she'll write back to resolve this problem.
I got another question regarding sh (not bash) and it's functions. I'm able to set a function but for some reason, it's not unsetting correctly.
That's how that goes but normal variables can be unset easily with the unset command. It's the functions that are a problem.Code:$ greet() { echo "Greet Baby!!"; }
$ greet
Greet Baby!!
$ set | grep greet
_='greet'
$ unset greet
$ greet
Greet Baby!!
Well, I just read the man page for ash and it clearly states that it's NOT possible to put a single quote within a single quote. Sorry for all this nuisance.
BTW, what command can I use to know the current shell that I'm running?
echo $SHELL
That won't work if I change shells to a different shell than the default assigned by /bin/login.
The only thing that I've gotten close to is 'ps | grep $$'