# image not being output with script



## krisdeniseriley (Jan 7, 2012)

So I have been trying to get this script to work for a few days now. The script is supposed to compare the wireless signal quality to if statements in a function and then echo an image. I just cannot seem to get the image to show up on the desktop when calling the wlanscript.sh from my conky. Can someone please look through the script and tell me if I am doing something wrong? I gave the script *sudo chmod +x wlanscript.sh* to make it executable, was that right?

From the conky I am calling the script with:

```
${alignc -10}${execpi /home/kris/wlanscript.sh}
```



```
#! /bin/bash
function dload()
{   
	if [ $lq -le 100 ] && [ $lq -gt 65 ]; then
	   echo '${image /home/kris/.images/wlan100.png -s 94x79 -p 10,520}'   
	fi   
	if [ $lq -le 66 ] && [ $lq -gt 55 ]; then   
	   echo '${image /home/kris/.images/wlan50.png -s 94x79 -p 100,25}'   
	fi   
	if [ $lq -le 56 ] && [ $lq -gt 49 ]; then   
	   echo '${image /home/kris/.images/wlan40.png -s 994x979 -p 10,725}'   
	fi   
	if [ $lq -le 50 ] && [ $lq -gt 5 ]; then   
	   echo '${image /home/kris/.images/wlan5.png -s 994x979 -p 0,625}'   
	fi
}

function usage()
{
echo ${image /home/kris/.images/wlan0.png -s 94x79 -p 100,25}
}


lq=$(sudo iwconfig eth1 | sed -n 's/.*Signal level[:=]-\([0-9]*\).*/\1/gp')
"$lq"=lq
if [ $lq -le 5 ]
then
usage
else
dload
fi
```


----------



## DutchDaemon (Jan 7, 2012)

> ```
> #! /bin/bash
> ```



FreeBSD is not Linux .. Either use /bin/sh for your scripts, or if it _has_ to be bash, install it from ports and point to it at /usr/local/bin/bash.


----------



## wblock@ (Jan 7, 2012)

The part that gets the signal strength is going to require some translating, too.


----------



## Alt (Jan 8, 2012)

Script output must be in binmode, right?


----------



## krisdeniseriley (Jan 8, 2012)

I am new to all this, and pardon me when I ask what is binmode. I am more of a JavaScript kind of guy, so I don't know much to very little about shell scripting.


----------



## Alt (Jan 9, 2012)

echo is a tool for printing text not a binary data like images. binary mode forbids editing stream being output to stdout. And I dont know how to switch it in shellscript =)


----------



## wblock@ (Jan 9, 2012)

binmode is a Perl thing, AFAIK, not applicable to shell scripts.  cat(1) could be used instead.  But the big problem here is that iwconfig, a Linux command, is trying to get signal strength from eth0, a Linux interface name.  On FreeBSD, that would be ifconfig(8) and the interface name depends on the wireless card.  Also, I don't have a wireless system handy to see how signal strength is shown by ifconfig.


----------

