0

I have the following two bash scripts (perhaps they can be condensed into one).

// pre-tail.sh

#!/usr/bin/env bash open -b com.apple.terminal `dirname $0`/tail.sh 

// tail.sh

#!/usr/bin/env bash tail -F ${FILE_TO_TAIL} 

I would execute like so:

FILE_TO_TAIL=some.log ./pre-tail.sh 

so I launch the first one, and ideally the output of the second bash script would appear in a new terminal window, but it doesn't quite work. Anyone have an idea why?

My other question is - instead of using com.apple.terminal, is there a more agnostic way to open up a new terminal window and run a command?

3
  • 1
    Have you tried using tee or tee -a? (See man tee.) Commented Jun 14, 2016 at 3:21
  • Define “doesn't quite work”. What's wrong? In what way does it partly work, but not completely? Commented Jun 14, 2016 at 20:23
  • It doesn't throw an error, but it's clearly not tailing a file, my guess is that it's not picking up ${FILE_TO_TAIL}, because when I hard code the correct path to a log file on that line, it works, any idea why that wouldn't reference the right value? I am using absolute paths in either case, so it shouldn't be a (relative) path issue. Commented Jun 14, 2016 at 21:10

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.