Find the answer to your Linux question:
Results 1 to 3 of 3
Do any one how to fix the following error. return: can only `return' from a function or sourced script I have 3 scripts submit_a.ksh a.ksh function.ksh The submit_a.ksh is just ...
  1. #1
    Just Joined!
    Join Date
    Sep 2009
    Posts
    4

    How to fix "return: can only `return' from a function or sourced script"

    Do any one how to fix the following error.

    return: can only `return' from a function or sourced script

    I have 3 scripts

    submit_a.ksh
    a.ksh
    function.ksh


    The submit_a.ksh is just a submit script which submits a.ksh at specific time using at command.

    Inside a.ksh I refer to function.ksh to calculate some values, if there is an issue with the calculation I use "return 1" to exit the function and send me a notification about the error. While executing the submit script I am receiving the above error.

    Appreciate inputs.

    Thanks

  2. #2
    Just Joined!
    Join Date
    Sep 2009
    Posts
    4
    I am submitting the job using at command. While submitting it reports "warning: commands will be executed using /bin/sh". - (BASH)

    Any one know how to change this so it picks /usr/bin/sh.

    thanks

  3. #3
    Linux Guru waterhead's Avatar
    Join Date
    Jul 2004
    Location
    Franklin, Wisconsin
    Posts
    4,577
    Quote Originally Posted by nkshanky View Post
    I am submitting the job using at command. While submitting it reports "warning: commands will be executed using /bin/sh". - (BASH)

    Any one know how to change this so it picks /usr/bin/sh.

    thanks
    State it in the first line of the script. Instead of it saying this:
    Code:
    #! /bin/bash
    have it say this:
    Code:
    #! /usr/bin/sh
    At least I THINK that is what you need to do.
    Paul

    Please do not send Private Messages to me with requests for help. I will not reply.

Posting Permissions

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