Skip to content
Advertisement

Change file permission for multiple file paths in a file

I have a file which stores multiple file paths in the file content, as such:

$ cat /var/tmp/sample
/etc/ssl/example/ssl-test1.cert
/etc/ssl/example/ssl-test2.cert
/etc/ssl/example/ssl-test3.cert
...

Is there a single line command to loop the file paths in the file and set the permission for each of the file paths chmod 644 <file paths in /var/tmp/sample>?

Advertisement

Answer

Another way to use xargs:

cat /var/tmp/sample | xargs -d 'n' chmod 644
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement