#!/bin/sh
echo "Input date with format yyyy mm dd:\c"
read year month day
echo "Today is $year/$month/$day, right"
echo "press enter to confirm and continue\c"
read a
echo "I know the date, bye"
echo "Input date with format yyyy mm dd:\c"
read year month day
echo "Today is $year/$month/$day, right"
echo "press enter to confirm and continue\c"
read a
echo "I know the date, bye"
注释:
#!/bin/sh 指定解析shell的类型,sh为传统shell,bash为默认使用的shell
\c这个转义字符表示,不换行,只能使用与sh类型的shell
本文介绍了一个简单的Shell脚本,用于提示用户输入日期并确认输入的正确性。该脚本通过传统的Shell解释器运行,并利用了特殊的转义字符来实现不换行的功能。
397

被折叠的 条评论
为什么被折叠?



