Anselm R. Garbe wrote:
> Your system clock seems to be broken.
yes, i know.
>> i've made some script for management my mpc:
>>
>> #!/bin/sh
>> st=$1
>> isdir="0";
>> IFS=$'\n'
>> st=`mpc ls $1 | wmiimenu`
>
> Why do you set st=$1 and then you overwrite its value?
it's my mistake. sorry.
> I also don't see a reason why manipulating IFS is necessary.
>
>> for name in `ls "/data/music/$st"` ; do
>> # IFS=$' \t\n'
>> if [ -d "/data/music/$name" ] ; then
>
> This looks wrong, did you mean /data/music/$st/$name?
yes :)
thanks.
>
>> isdir="1"
>> fi
>> # IFS=$'\n'
>> done
>> #set IFS=$' \t\n'
>> if [ "$isdir" != "1" ]; then
>> ./mpccont.sh "$st";
>> else
>> mpc clear
>> mpc add "$st"
>> mpc play;
>> fi
>
> I don't understand why you iterate over all files in the dir
> /data/music/$st to set isdir (it will always point to the last
> entry) and then deciding what todo.
if /data/music/$st contents directory than mean that id not directory
for play.
>
> #!/bin/sh
> song=`mpc ls $1 | wmiimenu`
> if test -d "/data/music/$song"
> then
> :
> else
> mpc clear
> mpc add "$song"
> mpc play
> fi
>
> Dunno if that is what you want todo...
> Regards,
not exactly.
#!/bin/sh
IFS=$'\n'
st=`mpc ls $1 | wmiimenu` # get list from mpc and
put selected into $st
isdir="0"; # if /data/music/$st
contents directory then
# mean that is not
directory for play.
for name in `ls "/data/music/$st"` ; do # if IFS=$' \t\n' then
title as "dir (space) name" will
# be translate as "dir"
and "name".
if [ -d "/data/music/$st/$name" ] ; then # if
/data/music/$st/$name is dir then set $isdir into "1"
isdir="1"
fi
done
if [ "$isdir" == "1" ]; then # if $isdir == "1" -->
exec ./mpccont.sh (self) again whith argument $st
exec ./mpccont.sh "$st";
else # else add and play dir $st
mpc clear
mpc add "$st"
mpc play;
fi
all work fine :)
Received on Mon Aug 14 2006 - 11:48:30 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:12:50 UTC