0

I am using cygwin for shell programming and this is my first program and i can't understand the error mentioned in the title at line 4 in for loop.here is the code

ski=0
wski=1
rwski=950435
for (( i = 1; i < 77; i++ ))
do  
    if [ $i -lt 45] ; then
        dd if=3d.jpg ibs=1024 count=1 skip=$ski of=myimage.dd obs=1024 seek=$wski conv=notrunc  
            expr $ski = $i
        expr $wski = $wski + $i
    else
        expr $rwski = $rwski - $i
        expr $ski = $i
        dd if=3d.jpg ibs=1024 count=1 skip=$ski of=myimage.dd obs=1024 seek=$rwski conv=notrunc
    fi
done

can someone please help me to correct this.

regards,

w

1
  • enable debuggin in youre script by changing the shebang to #!/bin/bash -x or do a set -vx at the top of your script. Then watch the output and verify that everything is expanded as expected Commented Sep 14, 2011 at 10:54

1 Answer 1

2

add a space after 45, ] is an argument for the function [.

but your problem is probably mixed dos/unix line endings, fix it with a proper editor or use dos2unix.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.