6/29/2023 0 Comments Os x open terminalHowever you can also put a shortcut on the dock or use launchpad. Make sure the script is actually executable ( chmod x). I find the quickest way to open a new Terminal window is just to type terminal into spotlight. Under Linux, usually you can access the default terminal with x-terminal-emulator: x-terminal-emulator -e "/path/to/script" This would automatically select the user-defined terminal emulator. command file and open that via open: touch mand Osascript -e "tell application \"$terminal\" to do script \"/path/to/script.sh\""īut I guess duti's functionality can be reverse-engineered by inspecting its source code. I think you could get the default terminal (if it's not Terminal.app) by inpecting the default file associations, but it's a little cumbersome without third-party tools such as duti (Use Homebrew to brew install duti), where you'd do: terminal=$(duti -x. Under macOS, all you would need to launch Terminal.app and run a script is: osascript -e 'tell application "Terminal" to do script "/path/to/script.sh"' You have to write separate functionalities for both operating systems. The ways to open applications are different among the OSes, too. Alternatively, you can press Shift U. Alternatively, simply click on your desktop wallpaper. It's a square icon with a half-light blue and half-dark blue smiley face. That is, when you double-click any executable script in the Finder, a new Terminal window will open. or not even running a graphical environment at all. Method 1 Using Finder 1 Click the Finder icon in your dock. Executable shell scripts are double-clickable in Mac OS X. Under macOS, that could be Terminal.app, iTerm2 or others, and under Linux you could have people running GNOME Terminal, Konsole, Terminator, etc. While macOS uses Unix underneath, the terminal applications under macOS and Linux are completely different, and the user might have different terminals installed. There's no cross-platform command do to that.
0 Comments
Leave a Reply. |