I have a command created and I am trying to convert it to an alias to make it easier to use, however I am unable to solve the problem as to how best to format it. Can you help me?
The principle of the command is simple, it runs two processes in one command, using docker containers, using other alias command. Looking the command below:
docker exec -it database_one bash -c "find ./data -type d -name '202*-*-*' -exec mongorestore --drop {} \;" && docker exec -it database_one mongo logindb --eval 'db.users.update({"username":"admin"},{$set:{"password":"test", "reset_password": false}});'
This command is perfectly fine the way it is, but I have problems with the various internal calls by other commands, such as docker and find, when I try to create an alias for it. I have tried to use eval, among others for this but without success.
alias
/eval
commands have you tried, and what happened? (Incidentally,eval
is almost never a suitable answer to anything.) – Chris Davies May 22 '23 at 18:42eval
blindly just because something doesn't work, but instead look into seeing how to build it properly. That might keep the shotgun from going off in the wrong direction. – ilkkachu May 22 '23 at 18:53