The stupid question is the question not asked | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hi all,
This is my first post here and my question is not so much about the exact code implementation at this stage but rather what is the best way to achieve this and is it possible.
So I have these two shell scripts that I need to run to create environments for my work and I can't make any changes to the shell scripts themselves. So the first shell script takes in files as well as a few arguments and created a directory based on them and it also prints in the terminal the path to the created dir. So for example my first script will look like this: ~/shell_1.csh file1 arg1 arg2 And the output from it will be a directory like this (number after the underscore is the date): /project/file1/file1_270821. I created a perl script to automate the execution of the above shell script I just give it all the files I need and it extracts the needed argument and runs the shell script for each one. The second shell script I need to execute in each of the created directories. So for the above example I would change my dir to /project/file1/file1_270821 and then execute shell_2.csh in it. This is tedious if I have just created 5 such directories for example, so I want to automate this. What i was thinking is to have it check the directories for all files I have passed to it and run the second shell script in the one with the latest date. So for example if I have passed file1, my perl script to go into the /project/file1 dir, find the file1_* with the latest date and then run the shell_2.csh in that dir. Is it possible for this to be achieved with perl? If yes is the way with checking dates the most efficient way? In reply to Automating execution of shell scripts by wisely
|
|