1 Star 0 Fork 11

大米饭/cups-filters

forked from coral0072/cups-filters 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ln-srf 855 Bytes
一键复制 编辑 原始数据 按行查看 历史
周淦清 提交于 2022-07-21 18:17 . Import Upstream version 1.27.4
#!/bin/sh
#
# Author: Carlos Santos <unixmania@gmail.com>
# This file is in public domain.
#
error() {
echo "$@" 1>&2
exit 1
}
src="$1"
dst="$2"
check_path() {
case "$2" in
*/../*|*/./*|*/.|*/..) error "$1 path '$2' must be absolute";;
*/) error "$1 path '$2' must not end with '/'";;
/?*) ;;
*) error "$1 path '$2' must start with '/'";;
esac
}
check_path "source" "$src"
check_path "destination" "$dst"
# strip leading '/'
src=${src#/*}
tmp=${dst#/*}
s_prefix=${src%%/*}
d_prefix=${tmp%%/*}
# strip leading common
while [ "$s_prefix" = "$d_prefix" ]; do
src="${src#$s_prefix/}"
tmp="${tmp#$d_prefix/}"
s_prefix=${src%%/*}
d_prefix=${tmp%%/*}
done
s_prefix="../"
while [ -n "$d_prefix" ] && [ "$tmp" != "$d_prefix" ]; do
s_prefix="../$s_prefix"
tmp="${tmp#$d_prefix/}"
d_prefix=${tmp%%/*}
done
ln -s -f "$s_prefix$src" "$dst"
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ymjnb/cups-filters.git
git@gitee.com:ymjnb/cups-filters.git
ymjnb
cups-filters
cups-filters
openkylin/yangtze

搜索帮助