xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

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://man.linuxde.net/echo

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, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2021-10-14 21:27  xgqfrms  阅读(50)  评论(3编辑  收藏  举报