#!/bin/bash DIR=$(dirname $0) function prefix_date(){ while read line do echo [$(date)] $line done } function run_update(){ git pull cd backend python manage.py migrate } run_update | prefix_date > $DIR/update.log