PDA
Partners

View Full Version : Bash shell script


whiteknight
February 8th, 2004, 05:26 PM
Okay, i'm trying to write a simple, dirty shell CGI script that will act as a simple hitcounter.

I know very little shell script, and am wondering how i would go about doing this.

dont ask why, i have no motives.

ggx
February 14th, 2004, 02:40 AM
#!/bin/sh

echo "Content-type: text/html\n\n";
echo "<html><body>Hi guys what's up?</body></html>";

you could place the count # in a file, and assign it to a variable and increment it, e.g.:

count = `cat filename`
let "count += 1"
echo "Visitor number $count"
echo "$count" > filename


the above code should read the number of visits from filename, increment it, print it, and save it to the file again.


-GG

whiteknight
February 14th, 2004, 10:51 AM
yeah, thanks man. I really want to learn more of this stuff so i can get better on linux machines, but it is so hard to find references or tutorials for it online.