![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| To convert multi format file to a readable ascii format | gaur.deepti | UNIX for Dummies Questions & Answers | 5 | 03-25-2008 03:03 PM |
| Convert UTF8 Format file to ANSI format | rajreddy | UNIX for Dummies Questions & Answers | 9 | 05-25-2007 09:26 AM |
| Convert UTF8 Format file to ANSI format | rajreddy | UNIX for Advanced & Expert Users | 1 | 05-24-2007 07:40 AM |
| convert mmddyy date format to ccyyddd format?? | Bhups | Shell Programming and Scripting | 2 | 09-28-2006 12:30 AM |
| change the empty function from the old format to the new format | powah | Shell Programming and Scripting | 0 | 06-23-2005 01:17 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
if format in functions
Hi everyone,
I am receiving this error: 0403-057 Syntax error at line 6 : `}' is not expected. when I try to enter in my function an if condition of the form: #! /bin/ksh do_t(){ var1="testing";recompr=0; [[ $1 -eq 1 ]] && {printit=0;F_N_s="testing""."xx"."yy;} } do_t 1 ########### Am I not doing this right? if I replace the if with the other format i.e. if [[ $1 -eq 1 ]];then printit=0;F_N_s="testing""."xx"."yy;fi it works fine Please let me know. Thanks! |
|
|||||
|
Hi. As long as one obeys the syntax rules, many forms are possible: Code:
#!/usr/bin/env ksh
# @(#) s1 Demonstrate syntax allowed for shell functions, ksh.
echo
export LC_ALL=C
echo "Environment: LC_ALL = $LC_ALL"
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version "=o" $(_eat $0 $1)
echo
one()
{
echo " One called." >&2
return 0
}
two(){
echo " Two called." >&2
return 0
}
three(){ echo " Three called." >&2 ; return 0
}
four(){ echo " Four called." >&2 ; return 0 ; }
echo
echo " Results, calling one, two, three, four."
one
two
three
four
exit 0
producing: Code:
% ./s1 Environment: LC_ALL = C (Versions displayed with local utility "version") OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64 Distribution : Debian GNU/Linux 5.0 ksh 93s+ Results, calling one, two, three, four. One called. Two called. Three called. Four called. Best wishes ... cheers, drl |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|