![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Jan 2005
Posts: 2
Rep Power: 0
![]() |
a bash puzzle
Hi guys,
I've been trying to investigate why these two scriptlets give different results: 1. obcy:~ kor$ for file in "an example"; do echo $file; done an example 2. obcy:~ kor$ for file in `echo \"an example\"`; do echo "["$file"]"; done ["an] [example"] i'd be gratefull for any hints Greetings, Radek. |
|
|
|
|
|
#2 |
|
Professional Programmer
|
It seems that
echo \"an example\" Diz |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Jan 2005
Posts: 2
Rep Power: 0
![]() |
Hi and thanks for your answer,
in fact it doesn't need to be a new line since list separators are, as far as I know, any blank characters which are not escaped. The question really is why the quotes are passed to the output without being interpreted by the outer shell (which explains line-break) Greeting, radek |
|
|
|
|
|
#4 |
|
Programming Guru
![]() |
well \" is the escape for " as is \\ the escape for \ etc etc etc so you are telling the compiler to ignroe the queotes as normal programming and include them as the string.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|