2 Replies Latest reply on Mar 2, 2013 3:33 PM by Siddu angadi

    BL is not recognizing function in the script

      I want to run attached script as sudo user not as root. Would this work.

      When I execute BL is not recognizing main function.

      Does nsh allow to write functions as in shell script.

        • 1. Re: BL is not recognizing function in the script
          Bill Robinson

          where in the script do you set the USER variable?  also - i'm fairly certain USER is always going to evaluate to the currently logged in user, so you should use a different variable name if you are try to parameterize the user you want to run the su as.  otherwise the script seems ok.

          1 of 1 people found this helpful
          • 2. Re: BL is not recognizing function in the script
            Siddu angadi

            HI Chaitanya,

             

            Yes NSH support functions as same as Shell.

             

            Why it is not working because you are not passing the USER Variable at all in the script.  If you are providing the USER variable during run time (NSH paranmeter), call the value within your NSH script. say example: Put below line in 1st line of your script:

             

            USER=$1   ### if user variabe calling the as first paratmeter in NSH Scripting.

             

            I assume you are executing this script as root or anyother user which permission to su to specific user account

             

             

            Always I would prefer to use BLPackage amd put this script as external script. NSH script will be used when you executing the single script to multi OS.

             

            Thanks

            Siddu

            1 of 1 people found this helpful