NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Support Forum » LEDArray - Bash question

March 08, 2010
by gplouffe
gplouffe's Avatar

I am struggling with bash syntax and was hoping someone could help me sort it out. The following was working but I made some changes to the date format and (rookie move) did not have a backup. Now I am getting a syntax error on a line that worked fine before.

Here is the script. Pretty simple but this generates a syntax error noted below:

!/bin/bash

TWHEADER=' FOLLOW US ON TWITTER @ '

CURRENTDATE=$(date +%m%d%Y)

lcdtext="/home/fit/twitter/lcd.txt"

tweets=$(twidge lsrecent -su ) if [[ -n "$tweets" ]] ; then
tweets=$CURRENTDATE$TWHEADER$tweets

tweets=$( echo "$tweets" | tr '[:lower:]' '[:upper:]' ) echo $tweets > $lcdtext

else

echo "no tweets"

fi

The error I am getting is as follows: File "gettweet.sh", line 11 CURRENTDATE=$(date +%m%d%Y) ^ SyntaxError: invalid syntax

March 08, 2010
by gplouffe
gplouffe's Avatar

Apparently I need to take a break.... Working fine now. Had a problem between the keyboard and the floor...was executing as a python script vs a bash script...yeesh

March 10, 2010
by mcai8sh4
mcai8sh4's Avatar

just as a comment, you need a hash at the beginning, ie.

#!/bin/bash

-Steve

Post a Reply

Please log in to post a reply.

Did you know that two resistors plus a transistor can be used to make a better voltage supply? Learn more...