I'm new to bash, I'm just trying to pick in up in my free time. I'm writing a simple script that prints out the filename I supply as many times as there are characters in the filename, and then positive or negative based on the second argument. I'm getting an unexpected end of file error on this script, and I'm not sure why.
#!/bin/bash
FILENAME=$1
NUMBER=$2
COUNT=0;
STR=${#FILENAME}
while ($COUNT < $STR){
echo $FILENAME
$COUNT++
}
if ($NUMBER < 0)
echo "Negative"
if ($NUMBER > 0)
echo "Positive"
exit
I'm executing with
./script1.sh hello 2
and I'm expecting the output to be
hello
hello
hello
hello
hello
Positive
If anyone could shed some light as to what's going on with the error, that'd be great.
edit: forgot to add the second condition to add to the COUNT variable, and now I'm getting an error:
line 9: syntax error near unexpected token `{'
line 9: `while ($COUNT < $STR){'