LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-07-2012, 06:43 PM   #1
kross2100
LQ Newbie
 
Registered: Dec 2012
Posts: 9

Rep: Reputation: Disabled
Functions in UNIX


I'm trying to create a function using this
Code:
eo (){let re=$1%2; if (($re != 0)); then; echo "Odd"; else; echo "Even"; fi;}
but for some reason I keep getting this error message..
Code:
bash: syntax error near unexpected token `{let'
what am I missing?
 
Old 12-07-2012, 07:23 PM   #2
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,569
Blog Entries: 1

Rep: Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026
Try the following:

Code:
eo () { let re=$1%2; if (($re != 0)); then echo "Odd"; else echo "Even"; fi;}
Please note the absence of semi-colons after if / then.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OSE system call functions to Linux Sytem Call functions required roshantraj30 Linux - General 0 06-08-2009 02:06 AM
In UNIX/LINUX, some functions like LoadLibrary and GetProcAddress? chenjifu Programming 3 04-20-2009 02:24 PM
newbie to unix programming in C, needed a few simple prgs on these functions! wrapster Programming 7 06-29-2008 01:23 AM
LXer: OpenOffice.org Calc functions, part 1: Understanding functions LXer Syndicated Linux News 0 03-31-2007 12:01 PM
pointers to functions/member functions champ Programming 2 03-28-2003 06:22 PM


All times are GMT -5. The time now is 02:05 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration