Issue
I've got this files in a directory ...
src="https://i.stack.imgur.com/zhJjk.png" alt="enter image description here">
I want to change the permissions of files which others has execution permission. These are the files which I want to change the permissions:
If I try to change the permissions of these files with this command:
ls -l | cut -d ' ' -f 1,9 | grep '\-\-\x' | xargs chmod o+t
I've got this error:
chmod: invalid mode "-rw-r-S--x, -rw-r-S--x"
Why I've got this error? How can a I set the sticky bit to these files? What am I doing wrong?
Solution
xargs chmod
just wants the names of the files, but you're giving it the full output of ls -l
, so it interprets the existing modes as a mode option that makes no sense. You want something more like
ls -l | grep '\-\-\x' | cut -d ' ' -f 9 | xargs chmod o+t
to pass just the filenames to xargs
, but without knowing what you are actually trying to do, its tough to say if this is what you really want.
Answered By - Chris Dodd Answer Checked By - Mildred Charles (WPSolving Admin)