[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Backup script

Chris Norman wrote:
I've got that, the only thing, when I run the script first hand, I get:

: Bad interpreter: No such file or directory

At the top, I have:

I tried:

But that got the same results. The permission bits are:

-rwxr--r-- root root

I'm running it as root.

No probs, I have fixed that, just re-wrote it, and it seemed to work.

You had probably created the script on a Windows box, which puts carriage return characters at the end of each line that confuse shells trying to interpret them.

> I have
another problem now though:

Tar says it can't "stat" ls, says there's no such file or directory.

here's the script:


cd /var/ftp/backup;

for file in ls
do {
tar cf /home/backup/$file.tar.tar $file/
} done

What is the problem?

$file has only one value in this loop, "ls".
What you want is to capture the output of "ls" and use that:

  for file in `ls`

or in bash (clearer)

  for file in $(ls)

or (better still, you don't need ls at all)

  for file in *

P.S. Please don't top-post on this mailing list.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]