linux debian!
•
13 May 2011, 10:30
•
Journals
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
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
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
'while[ -e $file.$i ] ; do'
Any suggestion?
i tested on ubuntu 10.10 64 bit with bash
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.
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
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!
do it yourself else you won't learn :p
this is really easy to do in python :<
please :)
i have work to do and you need to study.
more coding less cf spam :)
<3