Domanda

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

È stato utile?

Soluzione

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);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top