cron job problem

I am trying to setup cronjob and once I start to save it is not working. This is what I am getting after I executed crontab -e, I am not even getting the privious entry and I am running from root.

crontab -e

421
10 3 * * * /usr/sbin/logadm
?
:wq
?

Why is it not saving? Any input is appreciated?

Type "crontab -l >crontab"

That should give you your current crontab.

Edit the file called "crontab"

Then do "crontab crontab" to put it back

And repeat "crontab -l" to confirm it has been set.

I agree with porter's suggestion's on how to use the crontab command safely. But to answer the question, you are not typing ed commands, so ed does not understand your input. That is why you get the question mark. It tells you that you made an error. You never asked ed to do anything, including display the current contents of the file. It is unforunate that crontab and other command default to running an antique editor. But you can control the editor which is used by setting your EDITOR environment variable. You really should set it to some editor you know so you don't find yourself in an alien editor.

thank you, how to provide the edit command? I want to use vi as the default. Thanks in advance.

EDITOR=vi
export EDITOR