ex23.pp 420 B

123456789101112131415161718192021
  1. Program Example23;
  2. { Program to demonstrate the Chmod function. }
  3. Uses linux;
  4. Var F : Text;
  5. begin
  6. { Create a file }
  7. Assign (f,'testex21');
  8. Rewrite (F);
  9. Writeln (f,'#!/bin/sh');
  10. Writeln (f,'echo Some text for this file');
  11. Close (F);
  12. { Octal() makes the correct number from a
  13. number that LOOKS octal }
  14. Chmod ('testex21',octal (777));
  15. { File is now executable }
  16. execl ('./testex21');
  17. end.