⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prepend.sh

📁 BASH Shell 编程 经典教程 《高级SHELL脚本编程》中文版
💻 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 + -