And if I append the script into the file glogin.sql, then things seem to work properly. Why sqlplus do not execute login.sql? In the Oracle document it says:
Previously, the SQL*Plus site and user profile files, glogin and login, were run when SQL*Plus was started with a username and password, or with /NOLOG. The profile files, glogin and login are now also run after successful CONNECT commands.