Question

I want to call from perl the command "touch" on a large list of files. The command I am using fails:

$cmd = "touch $list_of_files";
$ret=system("sudo -u user bash -c \"$cmd\"");
print $ret;

Is there a limitation of command length in bash or is it because I am using 'system'? Beside splitting the list of files in smaller lists is there a solution to my problem?

Thanks

Was it helpful?

Solution

Is there a limitation of command length in bash

I believe so. But why are you suing bash at all?

system("sudo", "-u", "user", "touch", @list_of_files);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top