I usually make scripts using examples from others'.
This one has me stumped. I am trying to make some dialog to search my music folder and then create a playlist for mpc.
I had this working once but I must have "tweaked" something wrong.
Can someone tell me why ARTIST1 is not being recognized as a variable?
In this script, it gets to the point of "No Artist Specified" ?? Help.
Code: Select all
#!/bin/bash
#################################################
########Playlists can also be created with
######## mpc ls | grep <artist>
######## mpc add
######## mpc save
#################################################
GTKDIALOG=gtkdialog
export mpcpl='
<window title="mpcpl - Playlist Generator">
<vbox>
<hbox>
<text><label>MPC Playlist Generator. Enter an Artist Name.</label></text>
</hbox>
<hbox>
<text><label>Artist:</label></text>
<entry accept="text"><variable>ARTIST1</variable><input>cat /usr/local/mpcpl/artist1</input></entry>
</hbox>
<hbox>
<button help>
<action>`Xdialog --wrap --screencenter --left --title "mpcpl - HELP" --msgbox "mpcpl is a simple GUI for Retrieving Artists From a Music Server and Creates a Playlist. \n\n1. Enter an Artist and Follow the Prompts \n3. Click "ok"\n \n\n " 600x0`</action>
</button>
<text><label>_____________</label></text>
<button ok></button>
<text><label>_____________</label></text>
<button cancel></button>
</hbox>
</vbox>
</window>
'
gtkdialog3 --program=mpcpl --center
#I=$IFS; IFS=""
#for STATEMENTS in $(gtkdialog3 --program=mpcpl --center); do
# eval $STATEMENTS
#done
#IFS=$I
#if [ $EXIT = OK ]; then
#######################
echo "$ARTIST1"
#echo $ARTIST1 > /usr/local/mpcpl/artist1
#ARTIST1=$(cat /usr/local/mpcpl/artist1)
if [ "$ARTIST1" = "" ];then
gxmessage -bg orange -center -title "mpcpl" "
ERROR: No Artist was specified.
" \
-buttons 'OK:1, QUIT:2'
case $? in
2) killall mpc-pl
;;
esac
The remainder of the code works if I get the variable.
This is the output from the terminal, so It recognizes what I type in.
Code: Select all
root@linux_server:~$ # mpc-pl
ARTIST1="elton john"
EXIT="OK"
Terminated