0

I am searching for a way to accomplish this on our AIX v7 platform. I do not have a strong unix(AIX) background, but am trying to write bash scripts to preform repetitive functions.

Very simply, I would like the bash script to wait until a certain string appears at the end of the log. The string could already exist in the log elsewhere.

I have read responses to similar questions and the answers are using options not available on our system. Here are the responses I have found: 1) uses read (-t option not available in our AIX version) Shell function to tail a log file for a specific string for a specific time

2) Uses pstree (pstree not installed) Unix to tail solution for waiting for a specific string or quitting after a timeout

3) Uses timeout (timeout is not installed) Run tail -f for a specific time in bash script

4) Uses tail --pid (--pid option is not available)

Community
  • 1
  • 1
r aldrich
  • 17
  • 2

1 Answers1

1

You can try

tail -f -n0 "$yourfile" | grep -ql "yourstring"

on my Linux, this works (almost) as expected. tail -f -n0 produces all lines that are added to the file, grep -ql quietly looks for a single match of "yourstring" in its input and exits afterwards.

Jasper
  • 3,939
  • 1
  • 18
  • 35
  • Thank you, I was spending way too much time on the tail command and its options. I did not even look at options for grep. Your suggestion is working for me. – r aldrich May 14 '15 at 23:04