-3

I've got this files in a directory ...

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:

enter image description here

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:

enter image description here

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?

José Carlos
  • 2,850
  • 12
  • 59
  • 95
  • probs better for Unix SE – treyBake Aug 20 '18 at 14:26
  • Sorry, I don't understand your answer – José Carlos Aug 20 '18 at 14:29
  • not an answer - a suggestion to ask question on Unix SE – treyBake Aug 20 '18 at 14:31
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Aug 20 '18 at 14:31
  • Ok, thank you for your help!!! – José Carlos Aug 20 '18 at 14:33

1 Answers1

1

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.

Chris Dodd
  • 119,907
  • 13
  • 134
  • 226
  • If someone is interested in the solution, the correct instruction is: ls –l | cut –d ‘ ‘ –f 1,9 | grep ‘\-\-x’ | cut –d ‘ ‘ -f 2 | xargs chmod o+t – José Carlos Aug 20 '18 at 14:40