linux debian!

Hey
I need to write a bash-script which makes similar things to logrotate. Renames a test.log file to test.log.1 and then to test.log.2!

I need every command! STEP TO STEP!
help please
thanks
Comments
18
basic stuff => search on google
i=1
file="test.log"
while [ -e $file.$i ]; do
echo "$file.$i exists"
let i=$i+1
done
echo "Moving file to $file.$i"
cp $file $file.$i
Thanks for the reply. How can I check that it's working or not?
Parent
how about running it and check if your filename changed? :D
Parent
Syntax error around command do.

'while[ -e $file.$i ] ; do'

Any suggestion?
Parent
;do it yourself
Parent
make sure you add indents

i tested on ubuntu 10.10 64 bit with bash
Parent
Sorry for bothering you with this, but I really don't know/understand a single word(command) from debian.

I don't even should learn this that's why I didn't show up on lessons and now I am sitting on my final exam and looking out of my head and browsing forums.
Once again sorry for bothering you with this, but are you sure it should work? :D.
Also, what's a indent?
Thanks a lot.
Parent
:p oh dear..

ok an ident is like a space... so for example:

void BOB(int i) {
return 10*i;
}

the return 10*i; bit is indented


and yes it works for me on Ubuntu which is based on Debian
Parent
Hmm, I think I did everything which is needed.
Here's what I did so far:

touch test.log
vi test.txt
-> i=1
file="test.log"
while [ -e $file.$i ]; do
echo "$file.$i exists"
let i=$i+1
done
echo "Moving file to $file.$i"
cp $file $file.$i
ESC+:wq
chmod +x test.txt
./test.txt
and then I get this syntax error.



2 task: Count the avarage file size in a folder. (recursive looks must be able) (awk or du)

I'd be really thankful if you could do this for me. Thanks!
Parent
QuoteI'd be really thankful if you could do this for me. Thanks!


do it yourself else you won't learn :p


this is really easy to do in python :<
Parent
That's the point, I DON'T HAVE to learn it. It has nothing to do with what I learn, hungarian schools...
please :)
Parent
no. :p

i have work to do and you need to study.

more coding less cf spam :)

<3
Parent
ok, thanks anyway
Parent
English schools dont teach such subjects either, unless you study programming ;)
Parent
I am not learning programming, I am learning to be a system administrator, and I have/had about 10 lessons which is not needed.
Parent
I keep reading lesbian.
Back to top