home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.shell:5117 comp.unix.questions:14830 comp.unix.admin:6728
- Newsgroups: comp.unix.shell,comp.unix.questions,comp.unix.admin
- Path: sparky!uunet!cs.utexas.edu!torn!utgpu!credit.erin.utoronto.ca!glover
- From: glover@credit.erin.utoronto.ca (Mike Glover)
- Subject: Re: Need HELP with functions in SH shell programming!
- Message-ID: <1992Dec19.225621.5797@credit.erin.utoronto.ca>
- Organization: University of Toronto, Erindale Campus
- References: <EJH.92Dec10164940@khonshu.colorado.edu> <1992Dec18.154617.14831@acd4.acd.com>
- Date: Sat, 19 Dec 1992 22:56:21 GMT
- Lines: 35
-
- In article <1992Dec18.154617.14831@acd4.acd.com> greene@IEDV4.acd.com ( Jonathan Greene ) writes:
- >Hi. I've written a shell script for the SH shell, and would like
- >to combine the the 2 places I have the same case statements into
- >into 1, by means of a function.
- >
- >The manual says a function is defined by:
- >
- >name () {list;} where name is the name of the function and
- >list is the list of commands you want the function to execute.
- >
- >When I execute the script, I get the error: '(' Unexpected.
- >I also can't figure out the correct way to call the function.
- >
-
- Try this little script and if it doesn't work mail me back (to save bandwidth)
-
- ========= 8< cut here
- #!/bin/sh
- name() {
- echo hi
- }
- name
-
- ======
-
- This, when run should echo hi. If it works, then take it from there. :)
-
- ttfn,
- Mike
-
- --
- _______________________________________________________________________________
- ___ "Mickey Mouse wears a timex watch."_ ???
- U| glover@credit.erin.utoronto.ca (Mike Glover)
- C|S University of Toronto Computing Services
-