Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 1
    Please explain what 'it's not working' means, are you getting an error? Are the files not getting moved? Do they end up somewhere else? Commented Jun 3, 2019 at 11:35
  • 5
    The solution looks incorrect to me - should be read FILENAMES (no $). Aside from the error, there are a number of other issues with the mentor's solution - it will fail for filenames that contain whitespace for example Commented Jun 3, 2019 at 11:35
  • Aside from the readline issue, cp $i $HOME should read cp "$i" "$HOME" to make sure you handle whitespace correctly. Always try to quote Bash variables. Commented Jun 3, 2019 at 11:39
  • After I entered the filenames as arguments it gives empty strings and did not copy files to $HOME location Commented Jun 3, 2019 at 11:40
  • 1
    @Edward unfortunately simply quoting the filenames isn't sufficient - the for loop will already have tokenized the $FILENAMES string on whitespace Commented Jun 3, 2019 at 11:45