Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 320574e9d9
Fetching contributors…

Cannot retrieve contributors at this time

executable file 74 lines (57 sloc) 1.412 kb
#!/bin/bash
YUER=$HOME/me/yuer
# music_directory "~/yuer"
# playlist_directory "~/yuer/playlist/"
# db_file "~/yuer/mpd/mpd.db"
# pid_file "~/yuer/mpd/mpd.pid"
# state_file "~/yuer/mpd/mpdstate"
# log_file "~/yuer/mpd/mpd.log"
MPD=$YUER/mpd
PLAYLIST=$YUER/playlist
MPDFILE=(mpd.db mpd.pid mpdstate mpd.log)
function dir_exit()
{
if [ -d $1 ]
then
echo "$1 目录已存在,没有创建"
else
echo "$1 目录不存在"
mkdir -p $1
fi
}
# 判断文件是否存在,不存在创建
#--------------------------------------------
function file_exit()
{
if [ -f $1 ]
then
echo "$1 文件存在,没有创建"
else
echo "不存在 $1,需要创建"
touch $1
fi
}
# 判断是否在 $HOME 目录下面,防止创建错误目录
#--------------------------------------------
function where_is_now()
{
where=`pwd`
if [ "$where" = "$1" ]
then
# XXX $PWD 系统变量 [?]
echo "现在是在 $PWD 目录下面"
else
echo "现在不再 $1 目录"
dir_exit $1
dir_exit $2
dir_exit $3
cd $2
for in_mpd in ${MPDFILE[*]}
do
file_exit $in_mpd
done
echo "现在是在 $PWD 目录下面"
fi
}
# 向 where_is_now 函数传递参数
where_is_now $YUER $MPD $PLAYLIST
Jump to Line
Something went wrong with that request. Please try again.