LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Please explain these commands for me (https://www.linuxquestions.org/questions/linux-newbie-8/please-explain-these-commands-for-me-945245/)

netbaby 05-16-2012 03:44 AM

Please explain these commands for me
 
Dear all,

I've a small question when I tried to check something in HP-UX:
Quote:

* 1st command:
$ echo '\'abc
bc

* 2nd command:
$ echo '\'xyzabc
\xyzabc

* 3rd command:
$ echo ''\'abc
'abc
Please find the result and explain me why we have those outputs?


Thank you very much :-)

fukawi1 05-16-2012 03:51 AM

This is not linux related and is in the wrong forum, and also sounds like homework to me...

Googling for "escape character" and "quoting strings" + whatever shell you are using will answer that for you.

schneidz 05-16-2012 09:42 AM

this is what i get for question 1 on fedora linux:
Code:

[schneidz@hyper ~]$ echo '\'abc
\abc

not sure why hp-ux is different ?

fukawi1 05-17-2012 02:22 AM

I am guessing this is the difference between the posix shell hp-ux will most likely be running, compared to the bash shell on fedora.

Im not particularly familiar with posix, so I cant be of any real help other than this link.
http://www.grymoire.com/Unix/Quote.html#uh-0

David the H. 05-18-2012 07:29 AM

I get that output if I run them in tcsh. Is that the shell you're using?

The c-shell is notorious for it's poorly-designed parsing ability.
http://www.grymoire.com/Unix/CshTop10.txt


All times are GMT -5. The time now is 05:22 PM.