aboutsummaryrefslogtreecommitdiffstats
path: root/mypath/exe.sh
blob: 058805862cd6565e8415cd8d79e26b3d8a15f9a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

# 检查参数个数
if [ $# -ne 1 ]; then
    echo "参数个数错误!"
    exit 1
fi

if [ $1 == "run" ]; then
    for file in *.sh; do
        filename="${file%.*}"
        ln -s "$file" "$filename"
    done
    echo "软链接创建完成!"
elif [ $1 == "del" ];then
    for file in *.sh; do
        filename="${file%.*}"
        rm -f "$filename"
    done
    echo "软链接删除成功!"
else
    echo "参数错误!"
    exit 1
fi