Linux echo command All In One
Linux echo command All In One
linux bash echo
$ man echo
$ echo $SHELL
/bin/zsh
$ echo $HOME
/Users/xgqfrms-mbp
$ echo $PATH
/usr/local/opt/sqlite/bin:/Users/xgqfrms-mbp/.yarn/bin:/Users/xgqfrms-mbp/.config/yarn/global/node_modules/.bin:/Users/xgqfrms-mbp/.nvm/versions/node/v12.18.0/bin:/Users/xgqfrms-mbp/.cargo/bin:/bin:/usr/bin:/usr/local/bin:/Users/xgqfrms-mbp/.cargo/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin:/usr/local/opt/sqlite/bin:/Users/xgqfrms-mbp/.yarn/bin:/Users/xgqfrms-mbp/.config/yarn/global/node_modules/.bin:/Users/xgqfrms-mbp/.nvm/versions/node/v12.18.0/bin:/Users/xgqfrms-mbp/.cargo/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin:/usr/local/mongodb/bin:/Users/xgqfrms-mbp/opt/anaconda3/bin:/Users/xgqfrms-mbp/Documents/dart-sdk/bin:/Users/xgqfrms-mbp/Library/Android/sdk/emulator:/Users/xgqfrms-mbp/Library/Android/sdk/tools:/Users/xgqfrms-mbp/Library/Android/sdk/tools/bin:/Users/xgqfrms-mbp/Library/Android/sdk/platform-tools:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin:/usr/local/mongodb/bin:/Users/xgqfrms-mbp/.cargo/bin:/bin:/usr/bin:/usr/local/bin:/Users/xgqfrms-mbp/.cargo/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin:/usr/local/opt/sqlite/bin:/Users/xgqfrms-mbp/.yarn/bin:/Users/xgqfrms-mbp/.config/yarn/global/node_modules/.bin:/Users/xgqfrms-mbp/.nvm/versions/node/v12.18.0/bin:/Users/xgqfrms-mbp/.cargo/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin:/usr/local/mongodb/bin:/Users/xgqfrms-mbp/anaconda3/bin:/Users/xgqfrms-mbp/Documents/dart-sdk/bin:/Users/xgqfrms-mbp/Library/Android/sdk/emulator:/Users/xgqfrms-mbp/Library/Android/sdk/tools:/Users/xgqfrms-mbp/Library/Android/sdk/tools/bin:/Users/xgqfrms-mbp/Library/Android/sdk/platform-tools:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin:/Users/xgqfrms-mbp/Documents/dart-sdk/bin:/usr/local/opt/sqlite/bin:/Users/xgqfrms-mbp/.yarn/bin:/Users/xgqfrms-mbp/.config/yarn/global/node_modules/.bin:/Users/xgqfrms-mbp/.nvm/versions/node/v12.18.0/bin:/Users/xgqfrms-mbp/.cargo/bin:/bin:/usr/bin:/usr/local/bin:/Users/xgqfrms-mbp/.cargo/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin:/usr/local/opt/sqlite/bin:/Users/xgqfrms-mbp/.yarn/bin:/Users/xgqfrms-mbp/.config/yarn/global/node_modules/.bin:/Users/xgqfrms-mbp/.nvm/versions/node/v12.18.0/bin:/Users/xgqfrms-mbp/.cargo/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin:/usr/local/mongodb/bin:/Users/xgqfrms-mbp/anaconda3/bin:/Users/xgqfrms-mbp/Documents/dart-sdk/bin:/Users/xgqfrms-mbp/Library/Android/sdk/emulator:/Users/xgqfrms-mbp/Library/Android/sdk/tools:/Users/xgqfrms-mbp/Library/Android/sdk/tools/bin:/Users/xgqfrms-mbp/Library/Android/sdk/platform-tools:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin:/usr/local/mongodb/bin:/Users/xgqfrms-mbp/.cargo/bin:/bin:/usr/bin:/usr/local/bin:/Users/xgqfrms-mbp/.cargo/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin:/usr/local/opt/sqlite/bin:/Users/xgqfrms-mbp/.yarn/bin:/Users/xgqfrms-mbp/.config/yarn/global/node_modules/.bin:/Users/xgqfrms-mbp/.nvm/versions/node/v12.18.0/bin:/Users/xgqfrms-mbp/.cargo/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin:/usr/local/mongodb/bin:/Users/xgqfrms-mbp/anaconda3/bin:/Users/xgqfrms-mbp/Documents/dart-sdk/bin:/Users/xgqfrms-mbp/Library/Android/sdk/emulator:/Users/xgqfrms-mbp/Library/Android/sdk/tools:/Users/xgqfrms-mbp/Library/Android/sdk/tools/bin:/Users/xgqfrms-mbp/Library/Android/sdk/platform-tools:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin:/Users/xgqfrms-mbp/Documents/Flutter/flutter/bin:/Users/xgqfrms-mbp/Library/Android/sdk/emulator:/Users/xgqfrms-mbp/Library/Android/sdk/tools:/Users/xgqfrms-mbp/Library/Android/sdk/tools/bin:/Users/xgqfrms-mbp/Library/Android/sdk/platform-tools
https://linux.die.net/man/1/echo
echo \n
换行 & EOF 多行注释 All In One
#!/bin/bash
# echo \n ❌
# echo "sed test\n"
# echo -e \n ✅
echo -e "sed test\n"
# echo $"双引号 ❌"
# echo $"sed test\n"
# echo $'单引号 ✅'
echo $'sed test\n'
printf "sed test\nabc xyz\n\n"
printf "sed test\nabc xyz"
# sed test
# abc xyz%
# printf % bug ❓zsh bug
# multi lines comments `<<EOF` & `EOF`
# multi_lines_comments = <<EOF
<<EOF
The \`%\` is not printed by \`printf\`, it's printed by \`zsh\` as part of its command prompt.
Bash uses \`$\` or something more complicated instead, that's why it looks different with bash.
\`printf\` prints the same thing both times, and following that the shell prints it's command prompt.
This command prompt looks different in \`zsh\` than in \`bash/sh\`.
https://stackoverflow.com/questions/8467424/echo-newline-in-bash-prints-literal-n
EOF
# echo "$multi_lines_comments"
refs
Linux bash echo 换行 All In One
https://www.cnblogs.com/xgqfrms/p/15402480.html
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/15408568.html
未经授权禁止转载,违者必究!