#tail -n 30 /u01/env/$1/tibco/tra/$1/application/logs/CARinboxBulk-Process_Archive.log |grep OutOfMemoryError |wc -l #!/bin/bash cd out/ for h in $(ls /u01/zbx/agt/bin/OutOfMemory_log_checks/) do cd /u01/zbx/agt/bin/OutOfMemory_log_checks/ mv $h.log.sh $h.sh #touch $h.sh #echo -e "#!/bin/bash\ntail -n 30 /u01/env/\$1/tibco/tra/\$1/application/logs/$h |grep OutOfMemoryError |wc -l" > $h.sh done