It is currently Fri, 15 Oct 2021 21:34:03 GMT



 
Author Message
 Functions in Bourne Shell
I have been working with functions within the Bourne Shell. I have recently
tried porting the shells to Ultrix, but have found that functions do not
work. Has anyone else run across this problem? Any suggestions? I could
not find any information in the manuals. Thanks in advance.


 Mon, 07 Mar 1994 07:13:13 GMT   
 Functions in Bourne Shell

I don't think functions are in the regular /bin/sh.  Try using /bin/sh5
(the sysVr2 shell) or ksh, both of which should be on your system if you
are running Ultrix 4.2.



 Mon, 07 Mar 1994 08:30:03 GMT   
 Functions in Bourne Shell

Yeah, /bin/sh doesn't have functions.  Try /bin/sh5 or /usr/bin/ksh.
Alternatively, try bash (the FSF shell), which is fairly stable by
now, free, and portable across lots of different computers.

david carlton
carl...@husc.harvard.edu



 Wed, 09 Mar 1994 04:48:57 GMT   
 Functions in Bourne Shell
In article <1991Sep18.17131...@sscvx1.ssc.gov> you write:

    #!/bin/sh
    # if you have SysV shell

    getyn() {
        while   echo "$* (y/n)? \c"
        do      read yn rest
                case $yn in
                [yY])   return 0                        ;;
                [nN])   return 1                        ;;
                *)      echo "Please answer y or n" >&2 ;;
                esac
        done
    }
    getyn "Do you wish to continue" || exit

    #!/bin/sh
    # if you don't have SysV shell

    getyn='
        while   echo "$* (y/n)? \c"
        do      read yn rest
                case $yn in
                [yY])   return=0; break                 ;;
                [nN])   return=1; break                 ;;
                *)      echo "Please answer y or n" >&2 ;;
                esac
        done
    '
    eval set -- `echo "Do you wish to continue"`
    eval "$getyn"
    [ $return -eq 1 ] && exit

                                        -Serge

-- Serge N. Smirnoff                        personal: s...@loniis.spb.su
   10/3 Dekabristov St                      work: postmas...@loniis.spb.su
   SU-190000 Sankt-Petersburg, Russia       CALL: +7 812 314 8592



 Sun, 13 Mar 1994 14:06:53 GMT   
 Functions in Bourne Shell
In article <1991Sep18.17131...@sscvx1.ssc.gov> you write:

    #!/bin/sh
    # if you have SysV shell

    getyn() {
        while   echo "$* (y/n)? \c"
        do      read yn rest
                case $yn in
                [yY])   return 0                        ;;
                [nN])   return 1                        ;;
                *)      echo "Please answer y or n" >&2 ;;
                esac
        done
    }
    getyn "Do you wish to continue" || exit

    #!/bin/sh
    # if you don't have SysV shell

    getyn='
        while   echo "$* (y/n)? \c"
        do      read yn rest
                case $yn in
                [yY])   return=0; break                 ;;
                [nN])   return=1; break                 ;;
                *)      echo "Please answer y or n" >&2 ;;
                esac
        done
    '
    eval set -- `echo "Do you wish to continue"`
    eval "$getyn"
    [ $return -eq 1 ] && exit

                                        -Serge

-- Serge N. Smirnoff                        personal: s...@loniis.spb.su
   10/3 Dekabristov St                      work: postmas...@loniis.spb.su
   SU-190000 Sankt-Petersburg, Russia       PHONE: +7 812 314 8592



 Tue, 15 Mar 1994 22:32:21 GMT   
 
   [ 5 post ] 

Similar Threads

1. aritmetic functions in Bourne shell

2. functions in Bourne shell

3. Challange: increment function in Bourne Shell

4. Functions in bourne shell: HP and the rest of the world

5. Looking for "DOSKEY" function under Bourne shell

6. code for "read" function of bourne shell

7. question on 'read' function with Bourne Shell

8. sh: how to write recursive functions in Bourne shell?

9. Light Speed Bourne Shell! (was: Bourne shell tricks)


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software