0

Is there any command that opens a new terminal tab or window and runs another command, eg. less +F ~/log.txt in the new tab/window?

2 Answers 2

1

Consider utilizing osascript to execute an Applescript.

For instance in your Terminal application run the following command:

osascript -e 'tell application "Terminal" to do script "less +F ~/log.txt"'

This will create a new Terminal window and run the less +F ~/log.txt command.

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you! Is there a way I could use this for other operating systems besides macOS? Linux and Windows basically.
No, osascript exists on mac only. Why have you tagged your question with macos tag?
@RobC or tmux for a more modern version. Personally I use :term in vim which gives me even more capabilities.
@TamaMcGlinn - Sure - I didn't mention that because macOS doesn't ship with builtin tmux - a $ brew install tmux is required.
0

This comes to my mind from old days ...

xterm -e program [options]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.