2
#!/bin/bash

kommando="java -jar '/home/git/yuicompressor-2.4.7/build/yuicompressor-2.4.7.jar'"
gitdir='/home/git/repositories/gitosis-admin.git/gitosis-export/dev/www/res/'

echo "Vil Du versionere ? (ja/nej)"
read yesno
    if [yesno="ja"]
then
    echo "Hvad vil du kalde denne version:"
read version 
else
    echo "ok - surethang !"

while
  IFS=$'\n' read linje
do
  case "$linje" in
    *.css )
      $kommando "$gitdir/$linje" --type css >> "$gitdir/`basename \"$linje\" .css`."version".css" ;;
    *.js  ) 
      $kommando "$gitdir/$linje" --type js  >> "$gitdir/`basename \"$linje\" .js`."version".js" ;;
    ?*)
  esac 
done < manifest.conf

when i run the script it gives me and error at line 36 (end) (when i serve the manifest to the while loop).

2 Answers 2

3

I see following errors in your code:

  • you not enclose if statement by fi
  • missed spaces in if header
  • use $ when you wanted to get variable value

So, instead of

read yesno
if [yesno="ja"]
then
    echo "Hvad vil du kalde denne version:"
    read version 
else
    echo "ok - surethang !"

you should write

read yesno
if [ $yesno = "ja" ]
then
    echo "Hvad vil du kalde denne version:"
    read version 
else
    echo "ok - surethang !"
fi
Sign up to request clarification or add additional context in comments.

Comments

2

You have at least stray ?*) with no terminating ;;. Also, the [yesno="ja"] comaprison is wrong, you lost one dollar and due to the dollar shortage cut down on space program. Try [[ "$yesno" = "ja" ]] instead.

Otherwise description of the error might be helpful.

2 Comments

Could you explain a little further what you mean ?
Did you write the code yourself? What is ?*) supposed to mean? What is it supposed to do in this case?

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.