我正在编写一个脚本来自动管理我的git电子邮件配置。在我的脚本中,我想输出一条消息,通知用户电子邮件配置已更改。我正在使用命令git config user.email
获取新的电子邮件地址。但是,它将其打印到新线上。我想将其与我的消息打印到同一行。
这就是我现在拥有的:
echo "Email not configured to Work in Work directory.";
git config user.email "myworkemail@myworkemail.com"
echo "Git email configuration has now been changed to "
git config user.email
只需使用类似的子壳替换:
echo "Email not configured to Work in Work directory.";
git config user.email "myworkemail@myworkemail.com"
echo "Git email configuration has now been changed to "$(git config user.email)""
help echo
:
选项:
-n不要附加newline
-e启用以下后斜线逃脱的解释
-e明确抑制反斜线逃脱的解释