About the Terminal (Shell)

I was searching data about the Terminal and found that:

https://developer.apple.com/library/archive/documentation/OpenSource/Conceptual/ShellScripting/CommandLInePrimer/CommandLine.html

Now, I have to read it.

What’s your question?

The question was in another.

How to set the working folder.

I asked the env values, understand how to set HOME, but it stays as the boot hd root folder… when I issue ls -l…

That said, the link above is useful for people who use Shell.

I can share my project:

Make sure your shell is interactive (3rd mode). With the two other modes, your shell resets between each call (including the current working directory).

You can enter several commands on the same line. Separate with ampersand “&” in Windows, and semicolon “;” in Mac.

for instance
mkdir zoe & cd zoe

1 Like

I will explorate and test. Thanks.

ls -l does not returns anything with mode = 2

Thank you, I do not knew that.

What I checked (by error ?) is to pass two lines (I selected two lines) and it worked !

Here is the project that demonstrates how Shell does not works (here).

The App.icns is 1,2MB, the project is 250KB…

Feel free to report errors, share better code, etc.

After a reboot minutes ago, the example project does not works (in wMain), but it was working yesterday.

The fix is simple, add the line (below) in wMain.Open Event:

mShell = New Shell

Save and you’re done.

I updated the example (with Xojo 2021 Release 1, I do not have the latest installed in this computer); URL:

Have you noticed your example tries to execute the selected text, instead of the whole text?
(took me perhaps 10 minutes to discover that, as I was tracking Xojo bugs that don’t exist :wink:)

2 Likes

I am very happy with this program, it successfully created an “Emile” folder on my computer :-).

2 Likes

Yes. For anyone who can’t have children or feels alone, you can adopt a folder… The name is fixed, though.

2 Likes

I :heart: this word.

1 Like

Yes, it was meant as is.

Tab to select the next line until the last one. I do not implemented the Shift-Tab to go to the previous line.

What I forget is why I’ve done that.

I also put all paragraphs in an array variable. (I do not recall what I had in mind when I do that).

Me too, but I cannot set that folder as the working folder.

Playing with the modes PopupMenu also is disturbing !

You can rename it at will, as usual…

Did you noticed that the cd Emile command returns an error ?

Did you noticed you can execute all lines ?

I urge everyone interested in learning about the Terminal interface for almost ANY Unix OS to take a look at Dave Taylor’s excellent book:

Learning Unix for OS X

It’s the best I’ve seen since SAM’S stopped publishing the Waite Group Press’ “UNIX Primer Plus” book. Amazon does have one copy of the original available ($$$):

Unix Primer Plus

1 Like

Good idea, but what if Xojo shell does not works ?

Try ls -l in Interactive mode…
Try man cd with the shared project and cry.

All I wanted to do was to mimick what I do in the Terminal (and those works fine in the Terminal…)

For the lazy, here is the result (first lines only):

BUILTIN(1)                BSD General Commands Manual               BUILTIN(1)

NNAAMMEE
     bbuuiillttiinn, !!, %%, .., ::, @@, {{, }}, aalliiaass, aalllloocc, bbgg, bbiinndd, bbiinnddkkeeyy, bbrreeaakk,
     bbrreeaakkssww, bbuuiillttiinnss, ccaassee, ccdd, cchhddiirr, ccoommmmaanndd, ccoommpplleettee, ccoonnttiinnuuee, ddeeffaauulltt,
     ddiirrss, ddoo, ddoonnee, eecchhoo, eecchhoottcc, eelliiff, eellssee, eenndd, eennddiiff, eennddssww, eessaacc, eevvaall,
     eexxeecc, eexxiitt, eexxppoorrtt, ffaallssee, ffcc, ffgg, ffiilleetteesstt, ffii, ffoorr, ffoorreeaacchh, ggeettooppttss,
     gglloobb, ggoottoo, hhaasshh, hhaasshhssttaatt, hhiissttoorryy, hhuupp, iiff, jjoobbiidd, jjoobbss, kkiillll, lliimmiitt,
     llooccaall, lloogg, llooggiinn, llooggoouutt, llss--FF, nniiccee, nnoohhuupp, nnoottiiffyy, oonniinnttrr, ppooppdd,
     pprriinntteennvv, ppuusshhdd, ppwwdd, rreeaadd, rreeaaddoonnllyy, rreehhaasshh, rreeppeeaatt, rreettuurrnn, sscchheedd, sseett,
     sseetteennvv, sseettttcc, sseettttyy, sseettvvaarr, sshhiifftt, ssoouurrccee, ssttoopp, ssuussppeenndd, sswwiittcchh,
     tteellllttcc, tteesstt, tthheenn, ttiimmee, ttiimmeess, ttrraapp, ttrruuee, ttyyppee, uulliimmiitt, uummaasskk,
     uunnaalliiaass, uunnccoommpplleettee, uunnhhaasshh, uunnlliimmiitt, uunnsseett, uunnsseetteennvv, uunnttiill, wwaaiitt,
     wwhheerree, wwhhiicchh, wwhhiillee -- shell built-in commands

Still, as you didn’t mentioned it, it was not easy to locate. It was also a cause of the problem you experienced (since nothing executed), so “meant as is” would imply you wanted to put troubles on yourself :thinking:

Perhaps a lack of planning?

I get it. Since you have two eyes, you get one character per eye. The Terminal is just for cyclops. :grin:

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.