文件内容:
PS1="$(hostname):${LOGNAME}:\${PWD} ${PROMPT} "
PS1="${FGOLD}$(hostname):${LOGNAME}:\${PWD} ${PROMPT} ${NORMAL}"
PS1=abd
PS1="$(hostname):$LOGNAME:\$PWD $PROMPT "
export PS1 LANG
我想更改的行:
PS1="$(hostname):${LOGNAME}:\${PWD} ${PROMPT} "
更换线:
PS1="${FGOLD}$(hostname):${LOGNAME}:\${PWD} ${PROMPT} ${NORMAL}"
答案1
你可以使用sed
:
sed 's/^PS1="\$(hostname).*\${PROMPT}.*/PS1="${FGOLD}$(hostname):${LOGNAME}:\\\${PWD} ${PROMPT} ${NORMAL}"/'