How do I call the Terminal?

I wanted to pass some orders to the macOS Terminal (and eventually do the simlar on other platforms), but apparently I do not know how to do that.

Worst, I do not know how to run it (check if it is running).

Is Terminal (the Unix command line application) the name on US macOS ?

The command is nothing fancy; ls, cd, mkdir “foo”… and even copy two files from the Downloads folder to the newly created folder.

I set a TextArea, place the commands, put a PushButton, etc. and when it was time to write code to talk to the Terminal, I was lost. Sad feeling.

À l’aide ! Aiuto ! Help ! Hilfe !
Hey ! I know how to ask for help for some languages…

Look at the Shell class.

Thanks Bob.

Is the Shell working on m1 ?
(does not seems)

I love AirDrop. I will check on an i5.

Sh**, API1 vs API2 there !

OK: I do not understand that I will get the results back…

I was looking at the Terminal window and saw nothing !

Sorry for the buz folks !

I add another TextArea for the results…

Some minutes later:
ls, when called from a shell leads to the boot volume directory, not the usual Terminal folder… another glitch to work-around…

She’ll runs without GUI, so you need to make your own window if needed.
And it doesn’t have a start folder unless you define it.

Thank you Christian.

It have a start folder, the boot volme by default.

I tried to set my default folder, but since I do not know the computer user name, how can I do that ?

Worst: cd Users does not set the folder to Users. I do that by hand in the Terminal, and it works there (El Capitan). I was even able to set the computer user name as the working folder, because know its name on my computer.

In a terminal, try this command: whoami
Which you can of course use in the shell :smiling_face:

Please always use full paths like /usr/bin/whoami to avoid trouble with missing path environment variable.

1 Like

Nice ! Thank you.

Thank you.

I tried to change the path to Users (or Applications) but it does not works. Used command is:
cd Users
cd Applications

That command works because when I set:
cd java

I get an error message (I got none with Users and Applications), in both i5 and m1.

I’m afraid I’m in a dead end.

Did you check examples coming with Xojo?
And you should not need cd.

1 Like

Yes.

I checked the examples right now; Funny to get the same result with a different design.

Xojo example list the root folder of the boot volume just like mine, read the screen shot above. The executed command is in the TextArea on the top…

I use cd because I have to open, save, load in “data” I sent to the Shell file(s).

I read the Xojo Shell documentation once more and see nothing that allows me to set the shell working directory.

If you would use ShellMBS class in MBS Xojo Plugins, you could set the CurrentDirectory property and define the starting path.

I don’t have a budget for this, sorry.