yeah, that’s what I was thinking. the vi command above searches and replaces oldaccount with newaccount and then closes with saving. I guess the question then is “is there another way to do this” or “is there a way to pass terminal using cron”

Just so you know for future reference, ‘sed’ is the tool that is normally used in a *nix environment for applying regular expression substitutions in a shell script. It’s also exactly what should be used in your case.

I’ll also point out that if you don’t particularly care about keeping account.dump.sql around until the next run, you can get rid of it entirely. ‘sed’ (think “stream editor”) is what the *nix world considers a filter program, meaning that it can read input from standard input, apply a transformation to it, and output the result to standard output, all without human interaction. Thus, it’s a perfect program to use in the middle of a pipe where you have some source program (mysqldump) and some sink program (mysql) where you need to do something in between (with a filter like sed) but don’t want to create a bunch of temporary files.

In your case, it’d look something like:

mysqldump | sed | mysqlI know you said you’ve got it all working, so this surely comes as largely irrelevant to you. But then again, the more you know…