Skip to main content
12 events
when toggle format what by license comment
Sep 17, 2015 at 13:52 comment added Mohammad This link will give a more description about glob+split:unix.stackexchange.com/questions/108963/…
Sep 17, 2015 at 12:18 history edited cuonglm CC BY-SA 3.0
added 2 characters in body
Sep 17, 2015 at 9:30 comment added cuonglm I added some details. For why printf is better than echo, you can see this answer.
Sep 17, 2015 at 9:27 history edited cuonglm CC BY-SA 3.0
added 119 characters in body
Sep 17, 2015 at 9:17 comment added Mohammad @cuonglm : You say quoting won't help me much. This is where I do not understand why.Why you say echo behavior is not POSIX compliant? Why you say printf is better? I tried it but I got almost the same execution time.
Sep 17, 2015 at 8:28 comment added cuonglm @mohammad.k: As I wrote in my answer, quote variable prevent glob+split part, and it will speed up the while loop. And I also noted that it won't help you much. Since when most of the shell echo behavior isn't POSIX compliant. printf '%s' "$i" is better.
Sep 17, 2015 at 8:25 comment added Mohammad I didn't got why quoting cannot solve the problem. I need more description.
Sep 17, 2015 at 8:19 history edited cuonglm CC BY-SA 3.0
added 78 characters in body
Sep 17, 2015 at 8:17 comment added netmonk time echo $( <xdditg106) >/dev/null real 0m0.125s user 0m0.085s sys 0m0.025s time echo "$( <xdditg106)" >/dev/null real 0m0.047s user 0m0.016s sys 0m0.022s
Sep 17, 2015 at 8:12 comment added Chris Davies Gotcha thank you. Even without that, the timing doubles when using an unquoted variable
Sep 17, 2015 at 8:11 comment added cuonglm @roaima: You didn't mention the glob part, which can be a huge reason, imaging something that /*/*/*/*../../../../*/*/*/*/../../../../ can be in the file content. Just want to point out the details.
Sep 17, 2015 at 8:02 history answered cuonglm CC BY-SA 3.0