DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2009-03-03 09:35:15

jessewatson
New member
Registered: 2009-03-03
Posts: 2

Weird garbled directory / file names when created via shell scripts...

Since I'm no linux wizard, I may be doing something absolutely idiotic...  But I don't think so.

I just got the fun plug working, and one of the first things I wanted to do was write a small shell script to be executed nightly for some backup via cron...  Anyway, I never got that far.

At this point, I am just attempting to *create a directory* named "foo" from within a shell script.

Yes, it is as simple as it sounds.

And yet, it fails, and in the oddest way.

Instead of "foo", it creates a garbled directory whose name doesn't even display within telnet when I type "ls".

The only way to delete this mutant directory is to access the drive from Windows and delete the garbled directory -- from there, the directory appears with this name (instead of "foo"):   FY921X~W

ACK!

Ideas?

Here is my script:
#!/bin/sh
mkdir foo

Here is how I'm running it:
. ./my_script

It completes "successfully" (without visible errors), and yet the directory created is obviously garbled.

I chmoded the script to be executable, and have tried running it directly (rather than sourcing it), but I get:

sh: ./my_script: not found

Running firmware version 1.06.

Help?

Offline

 

#2 2009-03-03 12:06:41

SweMart
Member
From: Stockholm, Sweden
Registered: 2008-03-18
Posts: 14

Re: Weird garbled directory / file names when created via shell scripts...

Weird, it works for me:

Code:

root@dns323:/tmp# cat test.sh
#!/bin/sh

mkdir test1
root@dns323:/tmp# chmod 755 test.sh
root@dns323:/tmp# ./test.sh
root@dns323:/tmp# ls -ld test1
drwxr-xr-x 2 root root 1024 Mar  3 11:02 test1
root@dns323:/tmp#

What editor did you use to write the script?

Edit: A way of debugging shellscripts is do fo the following: sh -x test.sh

Last edited by SweMart (2009-03-03 12:08:14)

Offline

 

#3 2009-03-04 06:38:42

jessewatson
New member
Registered: 2009-03-03
Posts: 2

Re: Weird garbled directory / file names when created via shell scripts...

Aha!  You nailed it!

I wrote the script from TextPad on a Windows box and it had bad (Windows) line endings...

When I editted in VI, I could see the bad line endings and delete them.

Boom, done.

What a strange manifestation though!

Thanks again!

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB