How-To Question -- xterm(1)/lxterminal(1) start up analog needed

20 views
Skip to first unread message

Clem Cole

unread,
May 31, 2024, 10:22:17 PMMay 31
to iterm2-discuss
To make a long story short, as part of the OpenSIMH Project (opensimh.org), we have simulators for classic computers from DEC, IBM, DG, HP, and the like. MacOS is one of the preferred target hosts, and many of us recommend iTerm2 manually and life is good in simple cases. But we've started to write some scripts to make it a tad easier for users to start up and experience some of the old systems, and I'm running into an interesting problem for which I do not seem to have a good solution.

With xterm(1) or lxterminal(1), we can put in a start-up script something like:

OS=`uname -s`
...
case ${OS}  in
              ...
Linux)
                        nohup lxterminal --command="telnet localhost 1025" > /dev/null 2>&1 &

                Darwin)
nohup xterm -e telnet localhost 1025 > /dev/null 2>&1 &
               ...
esac

To start up a terminal window on the console of the simulated system (or to any simulated serial port, for that matter), running an xterm(1) works for macOS fine, but we would like to be able to use an iterm2 window if we detect that is what the user is running.


There doesn't seem to be a UNIX man page which describes the switches like xterm(1) or the like [which for a 50+ year UNIX guy is sad].  However, poking at the docs and Internet search, we have failed with different attempts using Applescript and like and have not found something that seems to work analogous to the above simple line.  

We are doing something wrong / missing something obvious.

Any help to an old hacker would be useful.
Thanks,
Clem Cole



George Nachman

unread,
May 31, 2024, 11:07:36 PMMay 31
to iterm2-...@googlegroups.com
No, I don’t think there’s a simple way to do it. AppleScript could, but as you noticed, it is terrible. Commit 368df5135 adds support for —command=… similar to lxterminal.

--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iterm2-discuss/84f37237-6615-4860-8803-58fb2fe089f9n%40googlegroups.com.

Clem Cole

unread,
Jun 2, 2024, 1:05:13 AMJun 2
to iterm2-...@googlegroups.com
Many thanks -- I will try it ASAP.
Clem

You received this message because you are subscribed to a topic in the Google Groups "iterm2-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/iterm2-discuss/k8UyFDqpclM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to iterm2-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iterm2-discuss/CAB5Rqo%3DGe0xJHU01GECCL_uQjtcdnsetoXXMwsAP2hwg5c%3Dy3g%40mail.gmail.com.

George Nachman

unread,
Jun 2, 2024, 10:53:32 PMJun 2
to iterm2-...@googlegroups.com
The change was made on 5/31 so it wasn’t picked up by the nightly build until the next day. It’ll be in the 6/1 and 6/2 nightlies though.

Clem Cole

unread,
Jun 4, 2024, 8:11:41 PMJun 4
to iterm2-discuss
Outstanding:  nohup /Applications/iTerm.app/Contents/MacOS/iTerm2 --command="/opt/homebrew/bin/telnet localhost 1025" > /dev/null 2>&1 &
Work like charm with the 06/03-nightly I just updated too.

For whatever it's worth, iTerm2 is not obeying a  $PATH to find telnet and homebrew script that 'iterm2' /opt/homebrew/bin is not passing in the parameters.
But full pathnames is fine for our use .

I'm not sure if you are working with the brew folks on their 'cask' for iTerm2 - that bug is theirs and you can decide what the proper PATH behavior is for --command
Anyway - this is huge -- thank you so much,
Clem

George Nachman

unread,
Jun 4, 2024, 10:09:08 PMJun 4
to iterm2-...@googlegroups.com
Commit 5d2af20a4 modifies how the command is run to do `/usr/bin/login -fpq $USER $SHELL -c <command>`, which will search the path unless you use a weird shell that doesnt support -c.

Clem Cole

unread,
Jun 5, 2024, 5:30:23 PMJun 5
to iterm2-...@googlegroups.com
Excellent -- I'll try it as soon as it ripples through the nightly builds.
Thanks again,
Clem

Reply all
Reply to author
Forward
0 new messages