for loop error....
Conider the following code..
1 #!/bin/bash 2 3 for tst in I don't know if this'll work 4 do 5 echo "word :: $tst" 6 done Why the o/p is so amgious ? word :: I word :: dont know if thisll word :: work |
Quote:
Try this instead: for tst in I don\'t know if this\'ll work using the backslash to escape the single quotes. word :: I word :: don't word :: know word :: if word :: this'll word :: work |
I know .... but why the op is so illogical ??
|
Quote:
Just about all programming langs have an equivalent (often the same) rule to allow 'values' to have spaces or other (normally) special chars in them. |
Quote:
Code:
I don't know if this'll work Code:
I dont know if thisll work The blank spaces that actually act as field separators are shown here: Code:
I dont know if thisll work |
All times are GMT -5. The time now is 10:16 PM. |