in reply to Re^3: Is there a better way.
in thread Is there a better way.

In general built-in functions are less platform dependent than invoking a command line program which may behave differently on various flavors of UNIX. In this case, 'ls' probably will work the same everywhere, but the general rule holds...