WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [SOLVED]Running a script in Terminal  (Read 18382 times)

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
[SOLVED]Running a script in Terminal
« on: March 07, 2013, 11:27:08 AM »
Hi all

I'm new to the forum and Linux so my apologies if I have posted in the wrong section.
My problem as follows:

I have created a bash script and a perl script, saved them in /home/tc and set the appropriate permissions
however I can't seem to run them from a Terminal.
I have confirmed with pwd that I am in the same directory as the scripts and if I type ./MyScript.pl or ./Myscript.sh
I always get an error that it's not found.
I have also tried exec but to no avail.
What am I missing?

Thanks in advance
Paulo.

BTW: I'm using the latest CorePlus and booting off a USB stick formatted as FAT32.
« Last Edit: March 07, 2013, 01:49:13 PM by Paulo »

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Running a script in Terminal
« Reply #1 on: March 07, 2013, 11:35:47 AM »
Install bash.tcz and perl5.tcz from repo they are not installed by default.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11618
Re: Running a script in Terminal
« Reply #2 on: March 07, 2013, 11:46:58 AM »
Hi Paulo
For future reference
Quote
I always get an error that it's not found.
What's not found? Bash? Myscript.sh?
Next time, please don't interpret the error, post the actual error message.

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
Re: Running a script in Terminal
« Reply #3 on: March 07, 2013, 11:57:48 AM »
Hi bmarkus and thanks for the quick reply.

Perl was installed but I used the wrong shebang in the perl script, it was #!/bin/perl and
when I changed it to #!/usr/bin/perl all is well.

As for Bash, the machine I'm using for TC does not have an internet connection but my Windows PC does
but it's from a USB 3G connection so can I download the bash.tcz file, copy it to my USB flash drive that has TC on it?

If so, should I put it into cde/optional ? and once there how do I install it on TC ?

Thanks
Paulo.

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
Re: Running a script in Terminal
« Reply #4 on: March 07, 2013, 11:59:28 AM »
Rich

Sorry about that, the complete error message as follows:

Code: [Select]
./MyScript.sh: not found
« Last Edit: March 07, 2013, 12:01:00 PM by Paulo »

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Running a script in Terminal
« Reply #5 on: March 07, 2013, 12:27:34 PM »
Bash also requires ncurses and ncurses-common.
Are you sure you need bash?  Will #!/bin/sh ( busybox's ash ) suit your needs?

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
Re: Running a script in Terminal
« Reply #6 on: March 07, 2013, 12:36:28 PM »
Hi  gerald_clark

I would prefer to have bash as all of my scripts are for bash and I understand there are some
differences between bash and ash.

I see what you mean by the dependencies for bash, I downloaded bash.tcz on my Win box, then copied the file
across to the usb stick, putting into /cde/optional.
TC picked it up, installed it and is now complaining about libncurses.so.5 and I'm sure there will be more :-)
Tried to do a ldd on bash but there too it complains that it can't find the shared lib.
I don't mind hunting down the required libs on the net and my other nix boxes as long as I know which ones to get.
Anyone have a list of all the .so libs required by bash?

Thanks
Paulo.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Re: Running a script in Terminal
« Reply #7 on: March 07, 2013, 12:59:04 PM »
Hi bmarkus and thanks for the quick reply.

Perl was installed but I used the wrong shebang in the perl script, it was #!/bin/perl and
when I changed it to #!/usr/bin/perl all is well.

As for Bash, the machine I'm using for TC does not have an internet connection but my Windows PC does
but it's from a USB 3G connection so can I download the bash.tcz file, copy it to my USB flash drive that has TC on it?

If so, should I put it into cde/optional ? and once there how do I install it on TC ?

Thanks
Paulo.

You need .md5.txt and .dep files for a .tcz where .dep may be missing. .tree lists all packages a .tcz depends on.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11618
Re: Running a script in Terminal
« Reply #8 on: March 07, 2013, 01:07:30 PM »
Hi Paulo
Quote
I don't mind hunting down the required libs on the net and my other nix boxes as long as I know which ones to get.
There is nothing to hunt down. Any required lib that an app from the repository needs is in the repository.

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
Re: Running a script in Terminal
« Reply #9 on: March 07, 2013, 01:13:48 PM »
OK, understood but keep in mind that I don't have an internet connection on my TC box, so I'm using
my Win box to download the required files and then put them on the same usb drive as TC.

The only repo I could find is [ Removed ]
There are all the .tcz .info .list .md5 and in some cases a .dep (there are no .tree files).
However there is no .dep for bash.tcz
I tried downloading and installing ncurses-utils.tcz in the hope that it may contain the required libs but when
I try to install it there is an error:

Code: [Select]
mount: mounting /dev/loop32 on /tmp/tcloop/ncurses-utils failed: Invalid argument

     [EDIT]: Removed malformed link. Rich
« Last Edit: March 08, 2013, 12:27:53 AM by Rich »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11618
Re: Running a script in Terminal
« Reply #10 on: March 07, 2013, 01:22:50 PM »
Hi Paulo
You also need  ncurses.tcz
By the way, this is a bad way to do this. You would be better off if you used core2usb to install CorePlus to your
USB drive. Then boot that on your Windows machine and get the wireless connection set up. Then you can use
the Apps utility to install applications properly. Once they are installed, you can move the USB drive back to your
other machine.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Running a script in Terminal
« Reply #11 on: March 07, 2013, 01:26:36 PM »
Run TC in a virtual machine on WINDOWS to get familiar with package management and core concept.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
Re: Running a script in Terminal
« Reply #12 on: March 07, 2013, 01:48:45 PM »
Rich

The problem is not a wireless connection, it's a USB 3G modem, so even if I run TC on my Win box via a VM or by booting into it,
TC can't see the 3G modem so I'm pretty stuck doing it this way.

OK found ncurses.tcz, loaded it and all working now.

Thank you all for your help and patience.
I will mark this as solved.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Running a script in Terminal
« Reply #13 on: March 07, 2013, 02:03:40 PM »
Rich

The problem is not a wireless connection, it's a USB 3G modem, so even if I run TC on my Win box via a VM or by booting into it,
TC can't see the 3G modem so I'm pretty stuck doing it this way.

OK found ncurses.tcz, loaded it and all working now.

Thank you all for your help and patience.
I will mark this as solved.


If you have nework access in WINDOWS, TC will see Internet from VM.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
Re: [SOLVED]Running a script in Terminal
« Reply #14 on: March 07, 2013, 02:12:15 PM »
Hi bmarkus

I agree with what you say, but for some reason my 3G modem and Virtual Box are not good friends.
Anyhow I actually learnt a lot about TC doing it the "long" way.

Next I'm going to install Apache and I see that it has deps of apr-util.tcz, openssl-0.9.8.tcz and pcre.tcz
so I will download those too and install them first.