Script Help

TheDevopsGuy

Posts: 681   +195
Hi All,

Currently configuring a new script.

Im currently capturing a variable from user input and storing it in variable "schemaname"

I want to use this variable to search in a directory and execute all files in said directory containing a certain string.

example if schema a is selected execute something like

ls | grep *a* > schema.txt

I want to then iterate through the schema.txt file in the particular directory and execute a command any clue what would be the best practice for this?
 
Doesnt have to be in a txt file but the gist is to itterate through a list which is generated from user input ex if schema a is selected execute a1.sql a2.sql ect
 
Ah it looks in a directory specific by a date variable specified by another function in the script there are 3 schemas users can enter im trying to regex and setup if else statements just checking on the ideal setup as how I’m planning it is kinda prone to errors
 
In the directory there are usually several files id like to automate deploy instead of running sql one by one on every server the script is able to retrieve the hosts to upload to in which directory to run its just a matter of implementing a safe setup on identifying all the files and uploading them to the correct schemas
 
I am sure you have a need for this but the process reminds me of shooting holes in the side of a barn expecting marvelous results when the chickens are in the pen across the road. Just doesn't make sense to me; no disrespect intended.
 
I am sure you have a need for this but the process reminds me of shooting holes in the side of a barn expecting marvelous results when the chickens are in the pen across the road. Just doesn't make sense to me; no disrespect intended.
I agree 100% to me its nothing big. Making the script involves mistakes to be made considering im not that good. I have a ticket which needs to be fulfilled, whether I want it or not.. Bosses know the risk. They want to cut costs thats all.
 
Back