Connect to DB2 table using Shell scripts

Can anyone please help me with an unix shell script to connect a DB2 database. My requirement is just to display the no of records present in a table of a DB2 database through Unix Shell script. Thx - Ram

db2 "connect to database user USERID using PASSWORD"
db2 "select count(*) from table"

save the above code in a file (preferably **.sh) and execute the script.