I need a simple shell script.
Imagine there are some directories like this;
and so on
Every folder has .env file.
In every .env file following variable available;
in another .env file DB=2
another .env file has DB=3
DB value is unique for each .env file for each website folder so each .env file should have different digits that never used in other .env files.
These are applied manually with vim editor now but i want to do it with shell script. At the moment I copy website folders and manually change DB value in new .env file.
Somehow shell script needs to grep DB variable and its value. List the digits (1,2,3 in above example) from varible DB in .env files and Sort them in order like 1,2,3,4...
Count 1 to 40 because DB value should not cross 40.
if .env files have DB value 1,2,3 then next DB value should be 4. When i create a new .env file shell script should replace new .env files DB value to 4 (DB=4).
Shell script needs to find which one is the next digit up to value 40 though.
Any questions please ask. Thanks
33 freelancers are bidding on average £19 for this job
I can do it to find the files recursively using script and can update the data based on your requirements. Let me know the best of your time so we can discuss and move forward to the next level.
hello Very simple bash shell script would fix the DB value in .env for given folder. call : ./fixDBId.sh -websitefoldername <<website2>> looking fwd to hear back from you. Refards Sandip
Hello, I am an expert in Linux (18 years of experience; Debian, Ubuntu, CentOS and many others) and shell scripting. What are you expecting after DB=40? I'm ready to start working on your project.
If Python script allowable then I could build you a flexible script to make sure the DB variables are unique and auto generated from 1 up to 40 in the .env files.