How can I prefix all commands in a shell without typing it each time?
My use case 1:
$ git init
$ git add -A
$ git commit
$ git push
Prefix should be git␣
(␣
is the space character)
init
add -A
commit
push
My use case 2:
sudo docker run my-repo/my-image
sudo docker ps
sudo docker images
Prefix should be sudo docker␣
run my-repo/my-image
ps
images
It would be best if I could do something like this:
$ git init
$ use_prefix sudo docker
> ps
> images
> exit
$ sudo docker run my-repo/my-image
git{space}
becomesgit
). The prefix is user-inputted. It is used likeuse_prefix sudo docker
so I don't need to type the prefix before each command.