Timeline for iterate over file and send lines as positional parameters to another file
Current License: CC BY-SA 3.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 23, 2017 at 12:40 | history | edited | CommunityBot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
| Jan 5, 2015 at 11:15 | history | edited | iyrin | CC BY-SA 3.0 |
edited to reflect OP data
|
| Jan 5, 2015 at 11:00 | comment | added | iyrin | This is pretty well explained here, although there are no examples for passing the output of each line as an argument for a script. stackoverflow.com/questions/10748703/… | |
| Jan 5, 2015 at 10:58 | comment | added | iyrin |
Ah good eye. Updated and explanation added. It is only working if I keep the echo command. To test, I am passing it to the_script which only contains echo $1. This does seem weird and redundant tho.
|
|
| Jan 5, 2015 at 10:54 | history | edited | iyrin | CC BY-SA 3.0 |
added 442 characters in body
|
| Jan 5, 2015 at 10:12 | comment | added | PM 2Ring |
Are you sure? Try it on the OP data, and you'll see it still doesn't work right. Also, echo $(some_command) is weird.
|
|
| Jan 5, 2015 at 10:05 | comment | added | iyrin | Hey thanks, PM 2Ring. It now passes each line as and argument to the script called. Although, Miroslav's solution is way easier imo. | |
| Jan 5, 2015 at 9:53 | history | edited | iyrin | CC BY-SA 3.0 |
deleted 278 characters in body
|
| Jan 5, 2015 at 9:26 | comment | added | PM 2Ring |
This doesn't do what geokrowding wants. If you try your code using the data in the OP you'll see that it prints each number from the file on a separate line. In other words, each invocation of echo gets passed a single word of the file. BTW, $(cat planets) is preferred over the form using backticks, see mywiki.wooledge.org/BashFAQ/082 . Another reason not to use backticks is that it's not easy to display backticks in these comments. :)
|
|
| Jan 5, 2015 at 9:00 | history | edited | iyrin | CC BY-SA 3.0 |
added 43 characters in body
|
| Jan 5, 2015 at 8:44 | history | edited | iyrin | CC BY-SA 3.0 |
added 87 characters in body
|
| Jan 5, 2015 at 8:38 | history | edited | iyrin | CC BY-SA 3.0 |
added 119 characters in body
|
| Jan 5, 2015 at 8:32 | history | answered | iyrin | CC BY-SA 3.0 |