Timeline for Write bash function which operates on list of filenames
Current License: CC BY-SA 3.0
19 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 10, 2015 at 20:26 | history | edited | jherran | CC BY-SA 3.0 |
added 2 characters in body
|
| S Feb 10, 2015 at 20:26 | history | suggested | thecommexokid | CC BY-SA 3.0 |
Added caveat from comments.
|
| Feb 10, 2015 at 20:16 | comment | added | jherran | @thecommexokid No reason, you can use double quotes on line 2 if you want. | |
| Feb 10, 2015 at 20:00 | comment | added | thecommexokid | @jherran Is there a particular reason for the mixture of single quotes in line 2 with double quotes elsewhere? | |
| Feb 10, 2015 at 19:58 | comment | added | thecommexokid | This answer works great for me. I edited in @godlygeek's warning about filenames into the bottom of the question to make sure others who come by this question will see it. | |
| Feb 10, 2015 at 19:56 | review | Suggested edits | |||
| S Feb 10, 2015 at 20:26 | |||||
| Feb 10, 2015 at 19:52 | vote | accept | thecommexokid | ||
| Feb 10, 2015 at 18:37 | review | Low quality posts | |||
| Feb 10, 2015 at 18:43 | |||||
| Feb 10, 2015 at 18:34 | comment | added | muru |
@godlygeek I didn't downvote. Since apparently some amount of interpretation is done by a shell on the other side (~, *, etc. working indicates that), I suppose a space separated list of files is possible as long as filenames don't have spaces.
|
|
| Feb 10, 2015 at 18:25 | comment | added | godlygeek | @muru, jw013, yes, it does work that way. You can test it pretty trivially before downvoting... | |
| Feb 10, 2015 at 18:19 | comment | added | jw013 |
I don't think that is proper scp syntax. You can't do user@host:"file list" as far as I am aware. You need to repeat user@host for each file.
|
|
| Feb 10, 2015 at 18:18 | comment | added | godlygeek | It's worth noting for posterity that this solution definitely won't work for complicated filenames. If a filename contains a space, or a newline, or quotes, this approach will definitely fail. | |
| Feb 10, 2015 at 18:18 | comment | added | muru |
The scp command strikes me as weird. Does it really work that way?
|
|
| Feb 10, 2015 at 18:17 | history | edited | muru | CC BY-SA 3.0 |
added 2 characters in body
|
| Feb 10, 2015 at 18:17 | comment | added | godlygeek | @muru, I'd argue it's harder to read for newbs. Just because you can be less verbose doesn't necessarily mean you should. | |
| Feb 10, 2015 at 18:17 | comment | added | jherran | @muru good to know. | |
| Feb 10, 2015 at 18:16 | comment | added | godlygeek | I had just finished typing in this exact answer, almost verbatim. I used "arg" instead of "x" and "args" instead of "files", otherwise letter for letter the same. Oh well, +1 | |
| Feb 10, 2015 at 18:16 | comment | added | muru |
You can skip the in $@. for i is a shortcut for for i in $@.
|
|
| Feb 10, 2015 at 18:14 | history | answered | jherran | CC BY-SA 3.0 |