How to invoke a post drush command? I am using Drush 9 and Drupal 8. When I execute drush site:install I find that it also modifies the permission of the web/site/default directory to r-xr-x--x, which troubles me delete that directory later. I want that directory to be 740 in my case. So two methods came to my mind. One is to run a custom shell script as post drush si or to override the default dush si command. I tried to go through some blogs but I couldn't understand them. Please explain stepwise. 

How can I invoke a custom shell script to drush site:install which will be run just after that command is executed. 

How can I override the default site:install command? 

Note: I am using Drupal composer project. So I have a drush folder outside the webroot but I don't know if I can edit some files in that directory and write my custom commands.
See the example file PolicyCommands.php in the Druhs examples directory. Create a directory named "Commands" in your site's "drush" directory, and put your command file there. Its name must end with "Commands.php" or "Hooks.php".

Create a hook similar to one of the ones shown in the example file. You'll want @hook post-command site:install.