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.

3
  • This is not correctly quoted. The output of that command substitution is subject both to $IFS and filename generation - both of which can/will generate multiple fields. Combined with a / separator and the -i option it's... well, it's not correctly quoted. Commented Jun 6, 2015 at 19:17
  • @mikeserv I agree it's possible to break it --- but with standard shell environment is quite safe. Almost anything can be broken with alias date=whatever before.... but yes, strictly, you are right. Commented Jun 6, 2015 at 21:17
  • No. Aliases are only interpreted in command position and when unquoted. Your error is not a risk for affecting shell state as such - but what you are doing is calling a script editor with the unambiguous instruction that it should definitely modify and overwrite its input file, but with nothing but ambiguity as to what that input file should be - whatever it might be will depend entirely on the executing user's environment. It is not quite safe. Commented Jun 6, 2015 at 21:50