我正在尝试创建一个脚本,将新的别名写入bashrc,但是当我运行scrip时,它会写入第一行或最后一行
with open ("/user/.bashrc","a+") as f1:
f1.write(new_alias + " " + alias_command)
f1.seek(0,0) # This writes in the first line and (1,0) writes in the last
command = f1.read()
print command # To show me the input without getting into the file every time
所以我想让它在输入新别名时创建一个新行,这样它就不会把所有内容都弄脏,并产生不必要的错误
使用
\n
可能是最简单的方法:相关问题 更多 >
编程相关推荐