Active Topics

 


Reply
Thread Tools
Posts: 3,841 | Thanked: 1,079 times | Joined on Nov 2006
#31
ls -l
on the file should show you the 'x' for executable. It's not located on a card though, is it? Scripts on cards are never executable, if it's a vfat card (the normal case).

You should be able to run the script with 'sh scriptname'
If that still fails, try
sh -x scriptname
and look at the output. It'll print each line as it executes it.
__________________
N800/OS2007|N900/Maemo5
-- Metalayer-crawler delenda est.
-- Current state: Fed up with everything MeeGo.
 

The Following User Says Thank You to TA-t3 For This Useful Post:
dfinch's Avatar
Posts: 362 | Thanked: 82 times | Joined on Jan 2008
#32
TA-t3 Thanks again!

It looks like the script is executable. This is the output from ls -l

~/MyDocs/Scripts $ ls -l backup-gvm.sh
-rwxr-xr-x 1 user users 64 Aug 29 16:24 backup-gvm.sh
~/MyDocs/Scripts $

(As you see I'm not working from a card)

Now, using sh backup-gvm.sh I get the following

~/MyDocs/Scripts $ sh backup-gvm.sh
backup-gvm.sh: cd: line 2: can't cd to /home/user
tar: .gvm: No such file or directory
tar: error exit delayed from previous errors
~/MyDocs/Scripts $


Strange that it can't cd to /home/user. If I execute this command from Scripts it takes me there no problem. Bear in mind that I have not yet added Scripts to the path. I want to proove it will run locally before going further.
Obviously tar won't work because it's in the wrong place to start.

This is my output with the -x

~/MyDocs/Scripts $ sh -x backup-gvm.sh
+ cd /home/user
backup-gvm.sh: cd: line 2: can't cd to /home/user
+ tar cf /media/mmc2/gvm-backup.tar .gvm
tar: .gvm: No such file or directory
tar: error exit delayed from previous errors
~/MyDocs/Scripts $

FWIW this script does create a file in mmc2 (internal memory) called gvm-backup.tar that is 1kb.

Is it possible that there is a slight error in the script you wrote? (no criticism - just wondering)

Cheers
__________________
N810, OS 2008 5.2008.43-7 (Diablo)
Nobody can accuse me of not contradicting the invalid arguments of the opposition!
Derek
 
Posts: 3,841 | Thanked: 1,079 times | Joined on Nov 2006
#33
OK, now I'm starting to suspect that the problem could be caused by how you made the scripts - you created them on Windows, right? They then probably have carriage return/line feed line endings, instead of just line feeds (as Unix use). I thought that wouldn't matter but now I'm not so sure.

OK I did a little test on my desktop - the CRLFs will confuse the issue.
Time to get rid of them.
Code:
cat backup-gvm.sh | tr -s '\r\n' '\n' > new.backup-gvm.sh
mv new.backup-gvm.sh backup-gvm.sh
Unless the 'tr' command (which is a busybox version) on the NIT is more retarted than I think the above should fix the script by changing CRLF to LF.
__________________
N800/OS2007|N900/Maemo5
-- Metalayer-crawler delenda est.
-- Current state: Fed up with everything MeeGo.
 

The Following User Says Thank You to TA-t3 For This Useful Post:
dfinch's Avatar
Posts: 362 | Thanked: 82 times | Joined on Jan 2008
#34
WE HAVE LIFTOFF !!!

That did it. I'm really surprised because I was using EditPad lite to make the scripts. I got this a while ago because Notepad does not handle linefeeds and carriage returns properly.

(It also took a while to find the pipe character since I was typing on the screen kbd!)

Anyway it looks like I am in business and you can now get on with your life instead of tutoring me

I really do appreciate you working with me, I have learned a lot (and remembered some from years ago).

Do you use EditPad lite? Is there a setting to overcome this problem? I was hoping to explore more scripting (using my PC) in the future but this is a pain to 'fix' every time on the tablet.

Cheers!

EDIT: I think I have broken something. Attempting to add the Scripts folder to the path I typed:

type 'PATH...' > .profile

Of course, if .profile already existed, I have overwritten the whole file with my single PATH statement. I should have used the append >>. Rats!

The reason I am concerned is because when I open xTerm, I get the message:
-sh: not: not found

Have I overwritten .profile?
Can I recover it?
How do I display the contents of a file in xTerm? (the equivalent of 'type filename' in DOS)

Thanks.
__________________
N810, OS 2008 5.2008.43-7 (Diablo)
Nobody can accuse me of not contradicting the invalid arguments of the opposition!
Derek

Last edited by dfinch; 2008-09-09 at 20:10. Reason: update info
 
Posts: 3,841 | Thanked: 1,079 times | Joined on Nov 2006
#35
You have overwritten the .profile file, unfortunately. Unless you have an old copy as a .profile~ (which is what e.g. 'vi' leaves behind) there's no way to recover it.

To look at a file you can use either
cat filename
or
more filename

'cat' just dumps it all to screen in one go and you have to scroll up and down if it's long. (It's the equivalent of 'type' I guess)

'more' will page through the file, and you can go back with 'b'. 'less' does the same, but will also be able to page back if it's not a file (e.g. it could be the output from a pipe - 'cat file | less')

I don't normally use Windows and never for editing, so I'm not familiar with editpad.
__________________
N800/OS2007|N900/Maemo5
-- Metalayer-crawler delenda est.
-- Current state: Fed up with everything MeeGo.
 

The Following User Says Thank You to TA-t3 For This Useful Post:
Reply

Tags
garnet, palm


 
Forum Jump


All times are GMT. The time now is 00:00.