Is there any way to manipulate terminal input before it gets executed? Example:
apt-get update is entered in the terminal. Now I want to change it to
sudo apt-get update before it gets executed.
What I tried:
I thought about a possibility to execute a script which would then execute the entered command with the manipulated Input, but I didn't find a way to run that script while another program should be executed.
I appreciate every answer. I'm on Linux Mint Serena.
Whenever a command is invoked there should be a script or whatsoever running in the background and check if it matches a pattern. If no then execute input and if yes then manipulate that command and execute -> That's why my example with
apt-get update to
sudo apt-get update. The only thing I can` figure out is, how that script would get that command before it would be executed.
When trying to access a specific file/directory do a password prompt
Creating shortcuts (
cd _1will be changed to