echo 是一个常用的 shell 命令,用于在终端输出文本
echo "Hello, World!" name="John" echo "Hello, $name!" echo -e "Line 1\nLine 2" echo -n "Please enter your name: " read name echo $(cat file.txt) echo -e "\033[31mRed text\033[0m" echo "Current date and time: $(date)" echo "Your current working directory is: $(pwd)" echo "This is a \$ sign." array=("apple" "banana" "cherry") echo "${array[@]}" 这些技巧可以帮助你更好地使用 echo 命令来完成各种任务。当然,还有更多关于 echo 的高级用法,但这里列出了一些基本的技巧。在编写 shell 脚本时,灵活运用这些技巧将大大提高你的工作效率。