Hi All,
I did a review of some threads to see if someone had come across this problem.
My system is an oracle virtual box solaris 10 installed on a windows 10 system.
Right now I am learning scripting and am just playing with the env variables.
I am trying to update the PATH to read from the oratab file and use it.
My problem: The result I get is not quite right in the little bash statement I had written. My new exported $PATH is echo'd and a space appears between the root path and the oracle path.
My oratab in /var/opt/oracle/oratab reads the following:
Since my oracle profile reads ..../dbhome_1 I changed the "1" to a "2" in the oratab file here so as not to get both confused and to see which one is
actually getting copied. I am just learning this bash scripting.
The oracle env path is the following at the env cmd:
in and I am using the following command to cut it from the oratab file:
output:
The result I get is not quite right in the little bash statement I had written.
My new exported $PATH (PATH=/usr/sbin/usr/bin:$ORACLE_HOME/bin) is echo'd and a space appears between the root path and the oracle path right afterthe colon.
output:
For the life of me I cannot figure out why this space appears above because it does not allow for other sql commands to be found and executed in my script.
Eventually i will add this to a loop statement to go thru the entire oratab file.
Any help would be appreciated.
Thanks in advance.
Last edited by rbatte1; 07-04-2017 at 12:32 PM..
Reason: code tags...
What editor are you using?
I tested your code on a AIX ( sorry that is all I have at the moment...) with ksh and cant recreate your issue... So to me nothing is wrong with your code unless there are some unprintable char ( which is often the case with files from windows... )
Not ignoring what Don has said (because that is very important), would you not be better using the IFS variable? The Input Field Separator (I think) is a way to chop up input in a more meaningful way to you, so you could perhaps:-
This should work in bash, but sadly I don't have a true ksh any more. The IFS setting as a colon : means that the output from the grep will be split up and you can read them into three variables, so you get the SID, the ORACLE_HOME that you really want and the Y or N value for it being auto-started. The variables you read are positional and the last variable gets everything to the end of the line, so if you miss out the YorN one, then $ORACLE_HOME
will be /export/home/oracle/app/oracle/product/12.1.0/dbhome_2:N which I assume you do not want.
In ksh, you might have to do this instead (untested) to get a similar result:-
I have a script like this running under OS X 10.8. The problem arises when the find command encounters a space in the path name. I need the "dir" variable as I'll be extending the script to more general use.
#!/bin/bash
CFS=$IFS
IFS=$(echo)
set dir = "/Users/apta/Library/Mail\... (3 Replies)
Hi I am using MKS Toolkit c shell.
I am trying to set a path variable something like c:/Program Files/blah/blah
so
set path=(c:/Program Files/blah/blah)
this, however, does not work as it splits this thing up into 'c:/Program' and
'Files/blah/blah'.
Does anyone have any ideas on... (9 Replies)
Hi I'm trying to select text between two lines, I'm using sed to to this, but I need to pass variables to it. For example
start="BEGIN /home/mavkoup/data"
end="END"
sed -n -e '/${start}/,/${end}/g' doesn't work. I've tried double quotes as well. I think there's a problem with the / in the... (4 Replies)
Hello Folks,
I want to append a path in user's PATH variable which should be available in current session.
Background
Numerous persons will run a utility.
Aim is to add the absolute path of the utility the first time it runs so that next runs have the PATH in env & users can directly run... (6 Replies)
Hi,
Could anyone help me in writing a single line code by either using (sed, awk, perl or whatever) to extract a specific path from the PATH environment variable?
for eg: suppose the PATH is being set as follows
PATH=/usr/bin/:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4
... (2 Replies)
Hi
I need a script which will remove a path from PATH environment variable. For example
$echo PATH
/usr/local/bin:/usr/bin:test/rmve:/usr/games
$echo rmv
test/rmve
Here I need a shell script which will remove rmv path (test/rmve) from PATH... (9 Replies)
Hello,
I need to execute the following command in a script:
/usr/bin/ssh 205.21.1.1 vmware-cmd -v /home/virtual machines//Machine.vmx"createsnapshot Weekly_Backup >/dev/null 2>&1
The problem is that there is a space between virtual and machines and when I run the script I get no such... (2 Replies)
OK I am trying to use something similar to this:
#!/bin/sh
echo "OK, starting now..."
sftp -b /dev/fd/0 user@remotehost <<EOF
cd pub
ascii
put filename.txt
bye
EOF
only difference is the dir I need to cd to has a space in it like this
/Import/Server/Prospect File
,... (3 Replies)
Hi everyone,
I create script for seaching count of differrent file types at my FS.
My script:
#! /bin/sh
#OLD_IFS=$IFS
#export IFS=$(echo "\n\t ")
echo "Wait a minute... Seaching is performed"
d=0;b=0;c=0;p=0;s=0;l=0;f=0
non=0
for fl in $(find /opt/google/picasa/3.0/wine/drive_c... (8 Replies)
Hello,
i have another sed question.. I'm trying to do variable substition with sed and i'm running into a problem.
my var1 is a string constructed like this:
filename1 filerev1 filepath1
my var2 is another string constructed like this:
filename2 filerev2 filepath2
when i do... (2 Replies)