replace seq with bash function