How do I get a Mac “.command” file to automatically quit after running a shell script?

前端 未结 7 2204
隐瞒了意图╮
隐瞒了意图╮ 2021-02-06 23:47

In my shell script, my last lines are:

...
echo \"$l\" done
done

exit

I have Terminal preference set to \"When the shell exits: Close the wind

7条回答
  •  渐次进展
    2021-02-07 00:17

    you could use some applescript hacking for this:

    tell application "Terminal"
        repeat with i from 1 to number of windows
            if (number of (tabs of (item i of windows) whose tty is "/dev/ttys002")) is not 0 then
                close item i of windows
                exit repeat
            end if
        end repeat
    end tell 
    

    replacing /dev/ttys002 with your tty

提交回复
热议问题