How to trigger a bash script from right click in Safari on a particular URL?
No - Safari is designed to not run code like that.

Could you imagine the damage someone would do with a malicious script to delete all a user's photos if they get them to click a link that could say anything and link to a malicious script underneath?