On Tue, Jul 23, 2002 at 10:05:27AM -0400, Gary J. Hanley wrote:
Can anyone tell me the pros & cons of coding your shell scripts to stay in-process instead of spawning a child process when needed?
The ones that immediately come to mind: Pro: You don't need to use extra resources to get the job done Con: It's not directly portable to other platforms /bin/sh on Linux is really bash. /bin/sh everywhere else that I know of is just sh and doesn't have the capabilities. If you want to be portable, don't rely on built-ins. If you don't care, use built-ins. For example: T=/path/to/file echo $T ${T##*/} Linux: $ sh t /path/to/file file Solaris: $ sh t t: bad substitution -- Randomly Generated Tagline: "...and scantily clad females, of course. Who cares if it's below zero outside" (By Linus Torvalds)