Tag Archives: EOF

Why execution is different from orginal bash registry$database?

By jediwannabe

Hi all,

here’s my script

Code:


#!/bin/ksh
if [ -z "$DB_CREATE_PATH" ]
then
export DB_CREATE_PATH=`pwd`
fi

echo
echo "********************--Menu--*****************************"
echo "*** "
echo "*** 1. Pre-Upgrade Steps "
echo "*** 7. Exit "

read a

if [ $a == 1 ]
then

echo "1 Pre-Upgrade Steps"
${ORACLE_HOME}/bin/sqlplus /nolog <<!EOF
set termout on
set echo on
set time on

connect / as SYSDBA;

column timecol new_value timestamp
column spool_extension new_value suffix
SELECT to_char(sysdate,'dd_Mon_yyyy_hhmi') timecol,'.log' spool_extension FROM
sys.dual;
column output new_value dbname
SELECT value || '_' output FROM v$parameter WHERE name = 'db_name';

--step 6 step 7 start
spool logs/tz_version_nls_char_&&dbname&&timestamp&&suffix
select TZ_VERSION from registry$database;
select value from NLS_DATABASE_PARAMETERS where parameter = 'NLS_NCHAR_CHARACTERSET';
spool off
--step 6 step 7 end

exit;
!EOF
fi


when I examine the output code it is as follow

Code:

09:30:41 SQL> select TZ_VERSION from registry;
select TZ_VERSION from registry
*
ERROR at line 1:
ORA-00942: table or view does not exist

09:30:41 SQL> select value from NLS_DATABASE_PARAMETERS where parameter = 'NLS_NCHAR_CHARACTERSET';

VALUE
-----------------------------------------------------------------------------------------------------------------------------
-------------------------
AL16UTF16

1 row selected.

09:30:41 SQL> spool off


can someone tell me how do I make sure that registry$database is queried instead of registry?

thanks

Source: FULL ARTICLE at The UNIX and Linux Forums

Unmatched <<

By yoavbe

Hi,
I am running sinple ksh script .
From some reason it failed on the following error:
./ogg_status.sh[14]: syntax error at line 16 : `<<' unmatched

Please advise.
#!/usr/bin/ksh
export ORACLE_HOME=/software/oracle/DB10gR2
export LD_LIBRARY_PATH=/software/oracle/DB10gR2/lib:/usr/lib
infoall() {
/goldengate/ggsci<<EOF
info all
exit
EOF
}

$ ./gg_status.sh
+ export ORACLE_HOME=/software/oracle/DB10gR2
+ export LD_LIBRARY_PATH=/software/oracle/DB10gR2/lib:/usr/lib
./ogg_status.sh[14]: syntax error at line 16 : `<<' unmatched

Source: FULL ARTICLE at The UNIX and Linux Forums

Joel Leclerc: bfdk – A brainf*** development kit

Yes, I know, yet another compiler/interpreter for brainf***… we all know how many there are, we all know how easy it is to write, etc… First, you have to know, that was my 3rd application written in C, and I needed an exercise in C (compilers, interpreters, plugin systems, API design, etc…), so I decided to write this. So for the features:

  • Compiler (compiles to C, then runs GCC) and interpreter
  • Supports multiple dialects (pbrain, brainlove, ook!, and blub)
  • Source slimming (strips all comments)

I know, not very exciting. You’re probably wondering where “development kit” comes in. That’s for later, as I planned to write some sort of shell for it, which would complete it. For now, I think it’s stable enough for general usage.

The source is available here: https://github.com/MiJyn/bfdk. Since this written was before I switched to vim, it uses eclipse makefiles, so it would be simplest for you to compile using eclipse. If you can’t, you can always use make -f Debug/makefile.

Here are some examples of usage:
bfdk -f hello.bf — Will run hello.bf
bfdk -c -f hello.bf -o hello — Will compile hello.bf to hello
bfdk -s -f hello.bf — Will output a slimmed version of hello.bf (you can also specify an output file using -o)
bfdk -d brainlove -f test.bl — Will run test.bl using the brainlove dialect
bfdk — Will run a shell (currently just a simple EOF thingy)

As I said in the beginning, this is not a serious product, this was just an exercise for fun. If you can find it useful, awesome, if not, don’t blame me for writing a useless product.


Source: FULL ARTICLE at Planet Ubuntu

Redirect output of command line to for loop

By tapia

I would like to redirect output of command line in for loop as $line.

Output should be processed as line but instead it throw whole output.

Could somebody help me on how to redirect output of command line and process it line by line without sending output to any file.

below is my code

Code:

result=`${HOME}/sqlplus << EOF
command
select * from xyz;
exit
EOF`
###############################
for line in ${result}
do
echo $line
echo ${result} | grep xxx


Now

Code:

${HOME}/sqlplus << EOF
command
select * from xyz;
exit


produce output like below .

Code:

xxx yyyy 11111 22222
xxx yyyy 33333 44444
aaa bbbb 5555 66666
aaa bbbb 7777 99999


Source: FULL ARTICLE at The UNIX and Linux Forums

Script partially executes??

By DBnixUser

Hi All,

I am calling a shell script from another shell script, however, it only executes part of it (the echo commands only). What could be some causes for that?

For example:

ShellScriptA.sh
——————–



. ShellScriptB.sh

ShellScriptB.sh contents:
——————————-
echo date
echo Connecting to database
sqlplus -S username/password << EOF – – – this point on is not executed.
….
….

However, when ShellScriptB.sh is executed independently it works just fine. Any ideas?

Thanks.

Source: FULL ARTICLE at The UNIX and Linux Forums

Cron Job – date command problem

By bobo_balde

Hi

I have one problem with cron job in Control Panel.
I have a log file that is created once a day on another server and I need to transfer it in an exact time to my server so I wrote the cron job for it BUT the problem is in the date command:

Code:

/filelog-`date +%Y-%m-%d`.tar.gz;


The file name is filelog-2013-01-04 and every day there is a new with a new date on it. But the problem is in my date command, it puts out an error:

Code:

/bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 1: syntax error: unexpected end of file


I need somebody to help me figure out where is the problem?

Thanks!

Source: FULL ARTICLE at The UNIX and Linux Forums

Eliminate error message (/dev/null)?

By newbie2010

I am trying to eliminate an error message from a script. This is the error message:

find: stat() error /usr/openv/netbackup/db/images/KUMAX: No such file or directory

if [[ -n “$new3” && -n “$uppervarn3” ]];
then runthiscommand=`su nxadm -c “ssh -t $new3 exec /bin/sh -s”>/tmp/filew3 2>/tmp/error.txt<<EOF
/usr/openv/netbackup/bin/bplist -C $uppervarn3 -t 13 -l -R $rec -s $startdate -e $enddate $pathoffiles
EOF`;fi

This error message is not of concern to me in that part of my script does pick up the correct directory. But because there is only a lowercase kumax directory and no KUMAX uppercase, when it goes to run the command to check the uppercase, it sends an error message because the upper case directory does not exist. I am trying to find out only how to eliminate the find (stat) error message. I’ve tried 2>/tmp/error.txt, /dev/null and other methods, and none of these works. Does anyone have experience eliminating error messages from scripts? Thanks in advance.

Source: FULL ARTICLE at The UNIX and Linux Forums

How to Parse the XML data along with the URL in Shell Script?

By Megala

Hi,

Can anybody help to solve this. I want to parse some xmldata along with the URL in the Shell.

I’m calling the URL via the curl command

Given below is my shell script file
export url=”http://localhost/test/apirequest.php?&apikey=Zm9ybSRAMCMjMjAxMy0wMS0wMyAxNDo0MjoyNg==&reqtype=xml&operation=insertRecords& xmldata=

New Company2

script=$(curl -s “$url”)
printf “%snDo you want to run this script? [yN]” “$script”
read line
case $line in
[Yy]|[Yy][Ee][Ss])
sh <<EOF
$script
EOF
esac

Thanks in Advance

Source: FULL ARTICLE at The UNIX and Linux Forums

ShellScript to Remove Newline in ouput.csv

By crmsachinHi friends,
I am running one SQL though .sh file and in output I am seeing newline whevnever There is a new line in column.
I WANT TO REMOVE NEWLINE IN OUTPUT FILE.

Present out put in Column:
————————-

Code:
Hi
How
Are
You.
Required output in Column:
————-

Code:
Hi How Are You.
Can anybody help me how to resolve this in Shell Script?? Below is my Script:

Code:
ORACLE_HOME=/app/oracle/product/11.1.0/client_1 ; export ORACLE_HOME
PATH=$PATH:/app/oracle/product/11.1.0/client_1/bin ; export PATH
cd /crmapp/crmpm

m=`date +%Y%m%d`

sqlplus -s abcd/efgh@crmdb = (sysdate-7);

spool off
quit
EOF

#mailx -m -s “Direct Debit Report” sladhwe.c@viva.com.bh,kgunasekaran@v…er@viva.com.bh
Source: The UNIX and Linux Forums