0
rated 0 times
[
0]
[
0]
/ answers: 1 / hits: 10022
/ 2 Years ago, mon, september 26, 2022, 11:22:42
I am making a script to simplify my daily tasks. Everyday, I have to grep for a few things inside a company server. It was okay, however, now, they have segregated each object into sub directories. I am looking for a solution in which my existing shell script will execute repeatedly into each sub directory inside a certain directory. How do I do this? I am quite new to Ubuntu and still learning the ropes.
Here's my script:
#!/bin/bash
#fetch start time of uut
grep -i "01_node_setup" his_file | tail -1 >> /home/xtee/sst-logs.out
#check if sysconfig.out exists
if [ -f sysconfig.out];
then
grep -A 1 "Drive Model" sysconfig.out | tail -1 >> /home/xtee/sst-logs.out
else
grep -m 1 "Pair0 DIMM0" node0/trans_file_prev/*setupsys* | tail -1 >> /home/xtee/sst-logs.out
fi
Basically I want to run this script to execute on all the existing sub directories of a certain directory. What do I do? Thanks!
More From » bash