create a sql script called test.sql:
set heading off;
select count(*) from V$session where status='ACTIVE';
Create a shell script that calls this and processes the output:
echo "$(sqlplus -S '/ as sysdba' @test.sql|grep -v '^$'|sed 's/^\t\t*//g') sessions are active now at $(date)"
You may want to structure the date format, and I am going on the assumption that you are running the script as the oracle account and the default '/ as sysdba' works (as it would normally given the script running as oracle)