1

When I run sudo fswebcam --png 9 -r 640x480 /var/www/image.jpg on my raspberry pi, it works fine.

If I add --banner-colour #ff0000 to it, like this:

sudo fswebcam --banner-colour #ff0000 --png 9 -r 640x480 /var/www/image.jpg

It tells me that my usage is wrong. Why is that argument not working?

  • Added the fswebcam tag - can you give a short description in the comments to add to the tag wiki? – Phil B. Oct 24 '15 at 2:43
2

I believe sudo treats a plain # (hash or pound) character as a comment. You need to escape this character to make it work, like so sudo fswebcam --banner-colour \#ff0000 --png 9 -r 640x480 /var/www/image.jpg.

I have not tried this with fswebcam, but on my Ubuntu desktop I did the following tests:

$ sudo echo #ff0000

$ sudo echo "#ff0000"
#ff0000
$ sudo echo \#ff0000
#ff0000
$ sudo echo #;echo "hello"

$ _

Which seems to support my answer.

 

1

Phil's solution worked for me. I wanted to change the line colour as well, so I used:

sudo fswebcam --banner-colour: \#000000 --line-colour \#ffffff --png 9 -r 640x480 /var/www/image.jpg

That worked fine on its own, but when I tried to combine it with watch, I was encountering the same error, despite the hashtags being escaped.

After some Googling, I was able to fix that problem by putting double quotes around all of the code that was being given to watch.

Here's the final code that I used:

watch -n10 "sudo fswebcam --banner-colour: \#000000 --line-colour \#ffffff --png 9 -r 640x480 /var/www/image.jpg"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.