0 脚本winopen 如下
#!/usr/bin/bash
# 2017.08.21 PM 8:20 Create by Yasser.
if [ "$1" != "" ] ; then
OLD="`echo $1`"
if [ "${OLD:0:1}" = "." ] ; then
OLD="`pwd`"${OLD:1}
ISDIR="`file $OLD | awk '{print $2}'`"
if [ "$ISDIR" = "directory" ] ; then
FIRST="`echo $OLD | cut -d / -f2`"
BODY="`echo ${OLD:2} | sed 's/\//\\\\/g'`"
FINALPATH="$FIRST:$BODY"
explorer $FINALPATH
echo $OLD
else
echo $OLD" not directory"
fi
fi
else
if [ "$1" == "" ] ; then
while read line
do
if [ "$line" != "" ] ; then
OLD="`echo $line`"
if [ "${OLD:0:1}" = "." ] ; then
OLD="`pwd`"${OLD:1}
ISDIR="`file $OLD | awk '{print $2}'`"
if [ "$ISDIR" = "directory" ] ; then
FIRST="`echo $OLD | cut -d / -f2`"
BODY="`echo ${OLD:2} | sed 's/\//\\\\/g'`"
FINALPATH="$FIRST:$BODY"
explorer $FINALPATH
echo $OLD
else
echo $OLD" not directory"
fi
fi
fi
done
exit
fi
fi
1 设置 环境变量
把脚本放到指定的环境目录中,不再赘述
2 使用
2.1 打开当前目录
winopen .
2.2 指定特定目录
winopen /c/mydir/study
2.3 与管道一起使用
pwd | winopen
2.4 批量打开所有目录
find . | winopen
网友评论