WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Terminal dialog in Micro Core  (Read 3200 times)

Offline cazz

  • Newbie
  • *
  • Posts: 5
Terminal dialog in Micro Core
« on: September 21, 2018, 06:36:03 AM »
Hi
This is my first topic here and I have only use TCL about 8 hour but I have read here and other places and got very far what I was looking for.
I have works with Linux many years now but is first time for me to work with this tiny linux :)

Now to my problem
I have TCL on a USB key and got everything to work.
In that USB key I have two bash script that I like to choose from and to make it nice I was thinking why not make a nice menu.
I did find I can use "dialog" but I guess I need to add some extensions because I get error on even a basic example

I have look and what I understand you have to install some if you run in a GUI but I going to run my in the terminal so what do I need??



Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Terminal dialog in Micro Core
« Reply #1 on: September 21, 2018, 07:02:51 AM »
Right. You need to install the  dialog  extension.
Code: [Select]
tce-load -wi dialog.tcz
It works on CLI without a desktop.

After installing, this should work.
Code: [Select]
dialog --calendar "" 1 0
Download a copy and keep it handy: Core book ;)

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: Terminal dialog in Micro Core
« Reply #2 on: September 21, 2018, 05:02:48 PM »
You can also search for an extension using:

Code: [Select]
tce-ab
Type "s", then type "dialog"

Code: [Select]
tce - Tiny Core Extension browser

         1. dialog-dev.tcz
         2. dialog-doc.tcz
         3. dialog.tcz

Enter selection ( 1 - 3 ) or (q)uit:

Note: You probably don't have bash installed, only sh or ash.
« Last Edit: September 21, 2018, 05:05:37 PM by Greg Erskine »

Offline cazz

  • Newbie
  • *
  • Posts: 5
Re: Terminal dialog in Micro Core
« Reply #3 on: September 24, 2018, 03:40:50 AM »
ohh thanks for the replay (Not sure why I did not get any email but I have to look into do that)

I have install the dialog and it works with the calendar but not my script or the basic examplescript

https://askubuntu.com/questions/1705/how-can-i-create-a-select-menu-in-a-shell-script

When I run that script it say
Quote
-sh: ./test.sh: not found

I did testing to remove the two first line and just have the code and then I get this error

Quote
./test.sh: line 2: syntax error: unexpected "("

I have install bash but what more do I have to install??

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: Terminal dialog in Micro Core
« Reply #4 on: September 24, 2018, 06:12:46 AM »
hi cazz,

dialog does not require bash. Your script on the other hand may need bash.

Scripts need the shebang first line.

When you install an extension through the proper tools all required extensions are also installed.

Did you set your script as executable?

regards
Greg



Offline cazz

  • Newbie
  • *
  • Posts: 5
Re: Terminal dialog in Micro Core
« Reply #5 on: September 24, 2018, 06:45:29 AM »
Hi Greg Erskine

hi yes I have done chmod +x script.sh

I just paste the example in notepad++
save it as test.sh

upload it with filezilla and then run the script.

I have other bash script that works great on the linux, is just the dialog that does not work for me


/Update

I did try just with

Code: [Select]
#!/bin/bash
I get

Quote
-sh: ./test.sh: not found
« Last Edit: September 24, 2018, 06:52:02 AM by cazz »

Offline Nathan_SR

  • Jr. Member
  • **
  • Posts: 82
    • Quick-Save-Live
Re: Terminal dialog in Micro Core
« Reply #6 on: September 24, 2018, 08:04:28 PM »

Try to get the full path of your script on the terminal with :

ls -lt `pwd`/test.sh

then call that script with the full path in dialog

probably the dialog is looking at the some path, where the script does not exist !


Offline cazz

  • Newbie
  • *
  • Posts: 5
Re: Terminal dialog in Micro Core
« Reply #7 on: September 25, 2018, 03:39:48 AM »
Quote
-sh: /home/tc/test.sh: not found


Hmm something is strange :)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11621
Re: Terminal dialog in Micro Core
« Reply #8 on: September 25, 2018, 09:36:16 AM »
Hi cazz
What does the following command return:
Code: [Select]
ls -a ~ | grep test

Offline cazz

  • Newbie
  • *
  • Posts: 5
Re: Terminal dialog in Micro Core
« Reply #9 on: September 27, 2018, 02:30:52 AM »
Quote
test.sh

Offline Nathan_SR

  • Jr. Member
  • **
  • Posts: 82
    • Quick-Save-Live
Re: Terminal dialog in Micro Core
« Reply #10 on: September 28, 2018, 08:03:53 PM »

Hi cazz,

A few tips:

1. You mentioned using notepad++, did you set EOL ( End of Line ) markers to Unix format and then saved the file ? Check Google if you are unable to locate this option in Notepad++
2. You can also use the command dos2unix filename on Linux to convert it to Linux format and then run it and check.
3. if it does not work still, other options are :

a. call bash full_path_to_file_name in the dialog command
b. instead of a script, try to make it single line, using ; between commands and supply it to your dialog command directly

Hope this helps. Please try all of these options and let us know which one works.

Regards,

Nathan SR