what language is this?

Associate
Joined
19 Jul 2006
Posts
1,847
I have this code
Code:
#!/bin/bash

FRESHCLAMLOG=/var/log/freshclam.log #change as needed

echo `date +%s` >> $FRESHCLAMLOG
echo 'Attempting to start /usr/bin/freshclam...' >> $FRESHCLAMLOG
/usr/bin/freshclam
if [ $? = 0 ] ; then
echo 'No errors returned.' >> $FRESHCLAMLOG
else
echo 'Something may have gone wrong.' >> $FRESHCLAMLOG
fi
echo 'Cron job attempt ending.' >> $FRESHCLAMLOG

Which works but i need to change the date function. but what language is this in, the echo statement to me looks like php but the fi isnt php.
Is bash a new language?
 
Standard shell script mate. In this case bash, with it could be korn shell also.

Oh and 'man date' will give you the output types for the date command - there's loads of options. ;)
 
Getting in to this bash stuff, wrote a few scripts that do back ups.

Which is the 2nd best language for manipulating linux perl or python?
 
If on windows, you can use cygwin to run it.
On linux, you paste into text file, save and set it as executable.
 
Note: "date" is not part of bash.

It's a separate program called by bash.

You can see terms for altering the format by firing up your POSIX (linux/cygwin) system's console and doing:

Code:
#man date
 
Getting in to this bash stuff, wrote a few scripts that do back ups.

Which is the 2nd best language for manipulating linux perl or python?

Depends on the curcumstance.
Personally I use perl because it's less strict and faster to write in.
Also most distros come with Perl installed, not too many come with Python iirc (maybe fedora/rh because yum is python?)
 
Back
Top Bottom