fix creting temporary file for bashrc, cleaneaning code, fix #2304