📄 prepend.sh
字号:
#!/bin/bash# prepend.sh: 在文件的开头添加文本. ## Kenny Stauffer所捐助的脚本例子, #+ 本文作者对这个脚本进行了少量修改. E_NOSUCHFILE=65read -p "File: " file # 'read'命令的-p参数用来显示提示符. if [ ! -e "$file" ]then # 如果这个文件不存在, 那就进来. echo "File $file not found." exit $E_NOSUCHFILEfiread -p "Title: " titlecat - $file <<<$title > $file.newecho "Modified file is $file.new"exit 0# 下边是'man bash'中的一段: # Here String# here document的一种变形,形式如下: # # <<<word# # word被扩展并且被提供到command的标准输入中.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -