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

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

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

#1 Post 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.
.
Last edited by sunburnt on Sun 10 Jun 2012, 04:50, edited 1 time in total.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#2 Post 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 ]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#3 Post 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
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#4 Post 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?
Last edited by sunburnt on Sun 10 Jun 2012, 02:12, edited 1 time in total.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#5 Post 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 .
Last edited by Karl Godt on Sun 10 Jun 2012, 02:18, edited 1 time in total.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#6 Post by sunburnt »

Karl; Now that makes sense... I`ll try it and let you know.!

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#7 Post 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.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#8 Post by sunburnt »

I just thought of a very possible reason.

I`ll be back in a few minutes.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#9 Post 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.
Last edited by sunburnt on Sun 10 Jun 2012, 03:04, edited 2 times in total.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#10 Post by Karl Godt »

what says

top

ps

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

?

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#11 Post 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" ..

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#12 Post 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. :)

Post Reply