From b8e3fc016754880a9bfb4551234d6d5a4fa621f5 Mon Sep 17 00:00:00 2001 From: flykhan Date: Mon, 14 Aug 2023 15:44:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=B7=B1=E7=BC=96=E5=86=99vim?= =?UTF-8?q?=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- day1/svim.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 day1/svim.sh diff --git a/day1/svim.sh b/day1/svim.sh new file mode 100755 index 0000000..49765d7 --- /dev/null +++ b/day1/svim.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# 设计 svim 编辑器的脚本,自动添加 shell 脚本的头部信息和文件权限, +# 并创建 /usr/bin/svim 的软链接 + +# 验证是否提供了文件路径 (文件名) +# 验证参数个数是否等于 1 +if [ $# -eq 1 ] +then + if [ ! -e $1 ]; then + echo "#!/bin/bash">$1 + echo "" >> $1 + chmod +x $1 + fi + vi +'set nonu' +'set fileencoding=utf-16' +2 $1 +else + echo "Usage: svim filename" +fi \ No newline at end of file