Page 1 of 1

Script won`t run hidden script, error. [ Solved ]

Posted: Sun 10 Jun 2012, 00:31
by sunburnt
A script runs another script named ".0", that runs a third script that runs an app. and waits until the app. quits.
When the app quits the third script runs ".0" again to cleanup.

Error when third script tries to run ".0":

sh-4.1# ./Audacious: line 2: 0: command not found

# As you can see by the error, the "." is gone, explaining the failure.
_____ Why would it be removed in the third script, but not in the first?

Audacious script:

Code: Select all

bin/audacious
.0 audacious-3.2.3.sq4
# Audacious script is exec., but has no: #!/bin/sh
_____ It runs the app., but not the hidden exit script.

Command file sequence:
Script: Audacious_audacious-3.2.3
__________ Runs command: .0 audacious-3.2.3.sq4 Audacious &

Script: .0
__________ Runs command: Audacious &

Script: Audacious
__________ Runs App., and then runs: .0 audacious-3.2.3.sq4
# audacious-3.2.3.sq4 = Name of SqApp file, and mount point for file.
.

Posted: Sun 10 Jun 2012, 00:59
by Karl Godt
bash-3.2# echo 'xmessage "HALLO"' > .0
bash-3.2# .0
bash: .0: Kommando nicht gefunden.
bash-3.2# ./.0
bash: ./.0: Permission denied

HTH

[ like ./configure
simply "configure" would also spit out "command not found" in normal circumstances ]

Posted: Sun 10 Jun 2012, 01:21
by technosaurus
same reason you can't execute README.txt, you have to set the executable bit (using chmod etc...)
The easy way is to cp an existing blank script (like the one in templates) and then echo to the copy with >>

even then you need the relative path (unless the directory is in PATH)
thus ./configure

Posted: Sun 10 Jun 2012, 02:04
by sunburnt
Hi Karl; The error is: command not found.
But the first script finds it and runs it just fine.

Hi technosaurus; ALL of the exec. bits shown in ROX properties are set.


I said above that the scripts all run, just the third script has a problem.

The two scripts: Audacious_audacious-3.2.3 and .0 have: #!/bin/sh

Audacious does not have it, but "all" exec. properties are set.


As I said, "Audacious_audacious-3.2.3" runs ".0" just fine.
".0" runs "Audacious" fine. But... "Audacious" won`t run ".0".


Doesn`t the missing "." in the error mean something?
If it gets trimmed off then it`s the wrong file and it can`t be found.
That`s the error that is being reported. Correct?

# Note: I forgot to mention that .0 is a link pointing to the real script.
____ But I can`t see that this makes any difference.

.0 is in the path of course. .0 points to a mount/ unmount script

# Should I post all 3 scripts?

Posted: Sun 10 Jun 2012, 02:12
by Karl Godt
bash has a default PATH buit in, also ash . It is possible to alter it in the source code . bash default PATH does not include /sbin and /usr/sbin i think or bash makes a difference before/after login (su/sudo ye all know) .

[here an example how not to do alter the source code for path to .bashrc :
/etc/bash/.bashrc:/etc/bash/bashrc:/etc/bash/.bashrc.system:/etc/bash/bashrc.system:/etc/.bash/.bashrc:/etc/.bash/bashrc:/etc/.bashrc:/etc/bashrc:/etc/.bashrc.system/etc/bashrc.system :lol: [ only likes one .bashrc , not many] ]

Probably you need a bang line as interpreter so the PATH is known, probably needs a #!/bin/bash --login to parse /etc/profile for PATH is normally in there .

Posted: Sun 10 Jun 2012, 02:14
by sunburnt
Karl; Now that makes sense... I`ll try it and let you know.!

Posted: Sun 10 Jun 2012, 02:19
by sunburnt
Karl; Nope... Didn`t change a thing. Still the same error.

I left out the shebang to save space as the Audacious file is a hook file.

But it doesn`t make any difference that I can see.

Posted: Sun 10 Jun 2012, 02:20
by sunburnt
I just thought of a very possible reason.

I`ll be back in a few minutes.

Posted: Sun 10 Jun 2012, 02:53
by sunburnt
Thank you both sooo very much!

This is a typical example of how I cause my own problems.

Karl gave me a hint talking about the shell path.

I realized that I had not rebooted with the new profile.local I had made.
I had set the path in the VT I was working in.

Then I realize that the path was probably being lost from script to script.
I did not export the path, but the setup didn`t need it with profile.local.

# The .0 script is being run now.




A new error: Can`t unmount the SqApp file, "Device or resource busy".
I figured I had to cd back out of the mount point, but that didn`t help.
I tried sleep 2 to give it time to shutdown, but that also didn`t help.

Something`s still hanging around inside the mount point.

Posted: Sun 10 Jun 2012, 02:58
by Karl Godt
what says

top

ps

[busybox] fuser -m /mnt/SqApp.sfs

?

Posted: Sun 10 Jun 2012, 03:03
by Karl Godt
sunburnt wrote:Thank you both sooo very much!

This is a typical example of how I cause my own problems.

Karl gave me a hint talking about the shell path.

I realized that I had not rebooted with the new profile.local I had made.
I had set the path in the VT I was working in.

Then I realize that the path was probably being lost from script to script.
I did not export the path, but the setup didn`t need it with profile.local.

# The .0 script is being run now.


A new error: Can`t unmount the SqApp file, "Device or resource busy".
I figured I had to cd back out of the mount point, but that didn`t help.
I tried sleep 2 to give it time to shutdown, but that also didn`t help.

Something`s still hanging around inside the mount point.
Such things happen to me every day :D :lol:

Excuse for not mentioning "export PATH" ..

Posted: Sun 10 Jun 2012, 03:07
by sunburnt
And again with causing myself problems.
The mount script doesn`t mount if the SqApp file`s mounted.
So changes to the script Audacious in the SqApp were not valid.

The Audacious script just needed a & at the end.

bin/audacious
.0 audacious-3.2.3.sq4 &

### An Audacious problem:

Code: Select all

** (process:8063): WARNING **: Desktop file '/opt/SqApp/mnt/audacious-3.2.3.sq4//share/applications/audacious.desktop' has malformed Icon key 'audacious.png'(should not include extension)
There`s 2 // in the path, maybe it`s problem.

I looked at other .desktop files and they all had the extension on the icon.
The error may be in error. The music player seems to work well. :)