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 except I think you go too far on builtins. To be clear echo printf type pwd are builtins; so are set shopt shift read readarray mapfile trap declare/typeset export local let readonly unset which don't affect the parent but may still be useful inside a moderately complicated -c. Commented Apr 15, 2016 at 8:06
  • What is your point?  Did you read my 6th bullet, where I said that builtins are useful in conjunction with external command(s)?  Are you saying that I should give more examples in bullet #6? Commented Apr 15, 2016 at 8:56
  • Thanks. Someone said that your reply also answered another question, but is that true? Commented Apr 15, 2016 at 15:53
  • @Tim: What question?  I see five question marks in that “question”.  OK, I’m kidding — a little.  What are you still unsure about?  I showed an example of sh -c being used with a complex command line including three programs, a pipe, a &&, and a redirection; I showed an example of it being used with a compound command line including a cd, a ;, and a program; I showed an example of it being used with exec; and I said it could be used with builtins like echo, kill, printf, pwd and type (and also exit, ulimit, and umask).  What more do you want to know?  … (Cont’d) Commented Apr 15, 2016 at 22:45
  • (Cont’d) …  If you mean “Does it mean execve() can operate on a script?”, (1) that has nothing to do with bash -c, and (2) what research have you done?  The execve man page answers this, and a search of this site yields this, this, this, this, this, and this. Commented Apr 15, 2016 at 22:45