[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash usage: was implicit linkage



Don Armstrong <don@debian.org> writes:
> On Sun, 12 Oct 2014, Steve Litt wrote:
>> This essay practically screams out for somebody to write a C program
>> that takes an argument of an arbitrary string, finds all files in a
>> directory, and returns a long string with those files separated by the
>> arbitrary string.
>
> You seem to be looking for find -print0; \0 is one of the few characters
> which is not valid to have in a file name.

Sadly POSIX has no -print0 for find[1]. So if you are for some reason
limited to POSIX, there is no nice solution.

> It's not like it's that hard to do this properly in a policy compliant
> POSIX shell, either. Use IFS and reset it as appropriate, or properly
> quote things. 

It's possible, but prone to errors.

Ansgar

  [1] <http://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html>


Reply to: