Find the answer to your Linux question:
Results 1 to 4 of 4
#!/bin/bash var=HELLO function hello { var=HY echo $var } echo $var hello echo $var OUTPUT: local-global-VAR.sh: function: not found HY local-global-VAR.sh: syntax error at line 8: `}' unexpected What is ...
  1. #1
    Just Joined!
    Join Date
    Jan 2007
    Posts
    9

    What is wrong here ?

    #!/bin/bash
    var=HELLO

    function hello {
    var=HY
    echo $var
    }

    echo $var
    hello
    echo $var



    OUTPUT:
    local-global-VAR.sh: function: not found
    HY
    local-global-VAR.sh: syntax error at line 8: `}' unexpected



    What is wrong here ?

  2. #2
    Trusted Penguin Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,392
    At a guess, I'd say that the problem is you're posting your homework questions to this forum, which is against the rules.
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Linux Engineer b2bwild's Avatar
    Join Date
    Jul 2008
    Location
    Behind You!
    Posts
    1,108
    Going through a guide will be a good solution to this small problem
    HERE
    Last edited by b2bwild; 02-24-2009 at 11:47 AM. Reason: typo
    Never make any misteaks.

    Read my Blog at --> Penguin Inside Subscribe Feed

  4. #4
    Linux Guru rokytnji's Avatar
    Join Date
    Jul 2008
    Location
    Pecos, Texas
    Posts
    2,943
    Thanks for that Link b2wild. Bookmarked it.
    Linux Registered User # 475019
    Lead,Follow, or get the heck out of the way
    AntiX,Puppy,Ubuntu,Windows 7=(cuz of scooters)
    Open CourseWare for Linux Geeks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...