How can I get a script to re-launch itself in a Terminal window if it wasn't started in one?
Based on this question, I've tried, in a file called
testterm marked executable:
#! /bin/sh if [ -t 0 ]; # stdin then echo "yay! terminal!" else Terminal sh ~/Desktop/testterm fi
Terminal just opens and never shows anything, or sometimes opens and goes away immediately.
From the Terminal if I type
Terminal sh ~/Desktop/testterm it works once, opening a Terminal with "yay! terminal!" in it, but then subsequent attempts yield empty Terminals.