Error while sudo to instance via bash script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error while sudo to instance via bash script
# 1  
Old 02-23-2017
Error while sudo to instance via bash script

Team ,

I am trying to sudo to instnace using a shell script .In out put i am getting this error for every line ...I am running this script as root ..



Code:
sudo su - userid -i db2 "command "

Error
Code:
/etc/profile[233]: shopt: not found [No such file or directory]

how can we overcome this error ? Can someone help on this ?

Last edited by rocking77; 02-23-2017 at 02:04 AM..
# 2  
Old 02-23-2017
examine the /etc/profile file and see line 233, it seems that someone has written a bash_profile over /etc/profile (shopt is a bash shell builtin)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Sudo has no access to exported bash function

Hello. I am running leap 15.1 sudo behavior may differ from other distrib. I have a file with functions definition .... function_1 { echo "Hello world" } export -f function_1 This file is sourced by both /etc/bash.bashrc.local and profile.local. So the functions are... (3 Replies)
Discussion started by: jcdole
3 Replies

2. Shell Programming and Scripting

Executing bash file with sudo for the second time, leads to permission denied, for some commands

I have a script that checks if the script has been ran with sudo. If the script is not ran as sudo, the current script is being executed with exec sudo bash. You are asked for a password, you type in the password, success. Everything is perfect - the commands inside the script are ran as sudo.... (1 Reply)
Discussion started by: boqsc
1 Replies

3. Shell Programming and Scripting

To trigger script on particular instance

Hi Guys, I have a main_script.sh which runs every day and scheduled in crontab. in the main script i read data from config file test.config apple mango orange main_script.sh for i in `cat test.config` do if then echo 'Apple' (3 Replies)
Discussion started by: Master_Mind
3 Replies

4. UNIX for Dummies Questions & Answers

Looking for first instance of an error in explorer log

Hi How to see the first instance of an error in explorer log ? In this case I want to know the first time error "SCSI transport failed" was populated in messages Thanks Amani (2 Replies)
Discussion started by: amani
2 Replies

5. Solaris

Getting error while trying to create a Solaris boot instance

I issue the following command to create a boot instance from an active boot instance on solaris 11.1. beadm create -a -d "Oracle x86 64 BIT Solaris SunOS Rel 5.11 Ver 11.1 10/2012 Enable SSH " OraSolBcp I get the following error below;- be_mount_callback: failed to mount dataset... (5 Replies)
Discussion started by: Tenyhwa
5 Replies

6. Shell Programming and Scripting

database instance Error capture

I wrote a script to capture some rows from the DB. However I want to capture the errors if the DB instance is down which usually produces errors like below. What should be my approach to kill script if the DB instance is down: DATABASE ERRORS: Msg 937, Level 14, State 1: Server... (2 Replies)
Discussion started by: moe458
2 Replies

7. OS X (Apple)

Bash script prompt for sudo password?

I'm making a script that will be a double clickable .command file and I need it to prompt for the users admin password. So far I have: if ]; then sudo -p "Please enter your admin password: " date 2>/dev/null 1>&2 if ; then echo "You entered an invalid password... (2 Replies)
Discussion started by: PatGmac
2 Replies

8. Shell Programming and Scripting

replace first instance(not first instance in line)

Alright, I think I know what I am doing with sed(which probably means I don't). But I cant figure out how to replace just the first occurance of a string. I have tried sed, ed, and grep but can't seem to figure it out. If you have any suggestions I am open to anything! (3 Replies)
Discussion started by: IronHorse7
3 Replies

9. Shell Programming and Scripting

Single Instance of a Shell Script

Hi, I have a shell script. What should I do to allow only single instance of the script to be run by a user at a time. That is, Only one user can run that script at a given point of time. Please help.. Its very important for my project Thanks in advance (4 Replies)
Discussion started by: pathanjalireddy
4 Replies

10. UNIX for Advanced & Expert Users

Printer Error(the Object Instance Test Does Not Exist)

Hello, i need some help about how to set up a high velocity impact printer in UNIX SCO 5.05, this printer is attached with a parallel port in a PC(host), the host use tunemul to access unix.(this reference is just to ask you if this is a local or remote connection, just to be sure), so, i... (2 Replies)
Discussion started by: jav_v
2 Replies
Login or Register to Ask a Question