chmod rx invalid

jaime@OpticaOmegaPlus:~$ echo 'date %T' >/tmp/midate; chmod rx /tmp/midate; /tmp/midate
chmod: invalid mode: ‘rx’
Try 'chmod --help' for more information.
-bash: /tmp/midate: Permission denied

Could someone tell me why it does not work

1 Answer

You're doing it wrong.

$ echo 'date +%T' >> /tmp/Temp_date && chmod +rx /tmp/Temp_date && /tmp/Temp_date
08:32:18
  • You need to add + sign before rx.
  • You need to add + sign before %T to ensure it recognized by date.
  • With all command fail, meaning you have not add content to file named midate on /tmp, that's why bash refuse to execute. As it was not valid script.
6

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like