Scripts Query

Theothersimon

New Member
I've been using the BootHDR package extensively, and would like to thank the individuals that developed it.

When you uninstall it, it leaves behind a few stray folders, so rather than bug you all to fix it, I thought I would have a go at writing a script to clean it up. I now have a ten line script, and I can run it perfectly from the command line.

I put the script in /mod/usr/bin with a .sh ending and sorted out the permissions. If I move to the /mod/usr/bin directory, I can run the script from ./myscript.sh - and tab complete works and the script runs fine.

However if I am anywhere else in the directory structure, even though the script is in the path:

humax# echo $PATH
/mod/bin:/mod/usr/bin:/mod/bin/busybox:/bin:/sbin

then it will not run. Or tab complete for that matter.

What am I doing wrong?
 
Nothing, as far as I can see. The directory is included in $PATH so you should be able to run that script from anywhere, including /mod/usr/bin just by entering myscript.sh
What happens when you omit the leading ./ ?
And I've never understood why opkg leaves orphaned folders after an uninstall. On the Foxsat HDR I got round this nuisance by adding a postrm script to each opkg package to remove them.
 
As Raydon suggests, run the script without the leading ./

The '.' specifies the start of the path you are defining as being the current folder you are sitting in, so the script won't run if it isn't in that same folder. Using simply myscript.sh should try all folders in $PATH.
 
Back
Top