bad options(s)


 
Thread Tools Search this Thread
Operating Systems Solaris bad options(s)
# 1  
Old 11-17-2011
bad options(s)

Hi Folks,

I am seeing an issue in solaris, while running a script..

Script contents

Code:
#!/usr/bin/bash

echo $HOME
echo "********** RUNNING props on test ********"
. /opt/home/weblogic/.profile > /dev/null
echo "****** CURRENT BRANCH: $BRANCH *********";

. /opt/home/weblogic/.profile has set -o emacs on it..

The issue is that when i run the script as ./test.sh, it works as expected..

But when i execute the script as sh test.sh or sh -xv test.sh, it throws bad options(s) error

sh -xv test.sh
#!/usr/bin/sh

echo $HOME
+ echo /opt/home/weblogic
/opt/home/weblogic
echo "********** RUNNING props on sswc01 ********"
+ echo ********** RUNNING props on sswc01 ********
********** RUNNING props on sswc01 ********
. /opt/home/weblogic/.profile > /dev/null
+ . /opt/home/weblogic/.profile
+ [ -f /opt/p4/ops/deploy/.profile.weblogic ]
+ . /opt/p4/ops/deploy/.profile.weblogic
+ set -o emacs
test.sh: -o: bad option(s)

/opt/p4/ops/deploy/.profile.weblogic has `set -o emacs` command on it

Can someone pls let me know how can i get rid of this. I am letting jenkins run these commands and jenkins cannot run it as ./test.sh unfortunately..

Appreciate your help..
# 2  
Old 11-17-2011
'set -o emacs' is pointless inside a shell script. It changes the way interactive shell prompts work, allowing you use arrow-keys and such to edit your line.

Using a different shell may allow it to work unmodified, though it's still pointless.

You may want to edit that .profile to make sure it only runs set -o emacs when $SHELL is the shell it expects.
# 3  
Old 11-17-2011
Quote:
Originally Posted by ganga.dharan
But when i execute the script as sh test.sh or sh -xv test.sh, it throws bad options(s) error
Here is your mistake. You shell script is clearly a bash one so you should run it with
Code:
bash test.sh

or
Code:
bash -xv test.sh

but not
Code:
sh ...

Bash is not sh, especially on Solaris.
# 4  
Old 11-18-2011
thanks bash test.sh worked like a charm.. thanks for the help
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print : Bad Options

Hi, I have this script here and it works fine but we keep getting this error and wanted to know how to stop it. Everything still works fine even though I'm seeing this error: typeset hd="" typeset -i hdsize=0 typeset -i hdsum=0 exec 3><directory>/hdisk-2145 print -u "---- 2145... (5 Replies)
Discussion started by: vpundit
5 Replies

2. Ubuntu

Kernel boot options removed by fault, no boot options

Hello Everyone, First of all, I highly appreciate all Linux forum members and whole Linux community. http://forums.linuxmint.com/images/smilies/icon_wink.gif. I wish you the best for all of you ! I will try to be short and concise: I am using Linux Mint 10 for 2 months on 2 ws, and all went... (3 Replies)
Discussion started by: cdt
3 Replies

3. Shell Programming and Scripting

Why I get bad bad substitution when using eval?

Why I get bad replace when using eval? $ map0=( "0" "0000" "0") $ i=0 $ eval echo \${map$i} 0000 $ a=`eval echo \${map$i}` !!!error happens!!! bash: ${map$i}: bad substitution How to resolve it ? Thanks! (5 Replies)
Discussion started by: 915086731
5 Replies

4. Shell Programming and Scripting

Script to search a bad record in a file then put the record in the bad file

I need to write a script that can find a bad record (for example: there is date field colom but value provided in the file for this field is N/A) then script shoud searches this pattern and then insert the whole record into the bad file. Example: File1 Name designation dateOfJoining... (2 Replies)
Discussion started by: shilendrajadon
2 Replies

5. UNIX for Advanced & Expert Users

Script to search a bad record in a file then put the record in the bad file

I need to write a script that can find a bad record (for example: there is date field colom but value provided in the file for this field is N/A) then script shoud searches this pattern and then insert the whole record into the bad file. Example: File1 Name designation dateOfJoining... (1 Reply)
Discussion started by: shilendrajadon
1 Replies

6. Shell Programming and Scripting

Bad Substitution

Need Help... I am getting a bad substitution error on my script on a Solaris Server. However the script has been proven to work on HPUX and Solaris servers... #!/usr/bin/sh # # Set the location of the tzupdater.jar file # JAR=/tmp/tzupdater.jar # <<<<< UPDATE THIS LINE... (3 Replies)
Discussion started by: D_Redd74
3 Replies

7. UNIX for Dummies Questions & Answers

I just did something bad....

I ran rm -rf lib*, I intended libm*, it deleted the whole lib dir from root. This is a dedicated webserver. What should I do? (4 Replies)
Discussion started by: Lss1
4 Replies
Login or Register to Ask a Question