Losing quotes after redirection


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Losing quotes after redirection
# 1  
Old 03-14-2011
Losing quotes after redirection

Hello experts,

Pleas

I have written a shell script to build a parfile but I keep losing the quotes from query1 and query variables after the redirection.. How do I fix this ?


Code:
PARFILE=${EXPDP_BASE}/expdp_${DAY}.par

USERID=$(${ORACLE_BASE}/getpass.ksh SYSTEM opnlkp2.uk.ml.com)
DUMP=expdp_full_${ORACLE_SID}.${DATEMON}_%U
DUMPFILE=${DUMP}.dmp
LOGFILE=${DUMP}.log
DIRECTORY=EXP_DIR
FDATE=`date +%d-%b-%Y`
FTIME=`date +%H:%M:%S`
FLASHBACK_TIME="TO_TIMESTAMP('${FDATE} ${FTIME}','DD-Mon-YYYY HH24:MI:SS')"
CONTENT=ALL
SCHEMAS=ENDUR
PARALLEL=4
FILESIZE=3G
QUERY1=ENDUR.SIM_BLOB:"where sim_run_id in (select sim_run_id from sim_header where run_time >= trunc(SYSDATE -5) or trunc(run_time) in (trunc(sysdate,'mm')-1, trunc(add_months(sysdate,-1),'mm')-1))"
QUERY2="ENDUR.SIM_HEADER:"where run_time >= trunc(SYSDATE -5) or trunc(run_time) in ( trunc(sysdate,'mm')-1, trunc(add_months(sysdate,-1),'mm')-1)"


Code:
#find ${EXPDP_BASE}/*.gz -mtime +5 -exec rm -f {} \;

# Check if file already exists, if so, delete it

#if [ -f ${EXPDP_BASE}/${DUMPFILE}.gz ]
#then
#     rm ${EXPDP_BASE}/${DUMPFILE}.gz
#fi


echo "# Parameter created on ${FDATE}"           > $PARFILE
echo " "                                        >> $PARFILE
echo "userid=$USERID"                           >> $PARFILE
echo "dumpfile=$DUMPFILE"                       >> $PARFILE
echo "logfile=$LOGFILE"                         >> $PARFILE
echo "directory=$DIRECTORY"                     >> $PARFILE
echo "flashback_time=\"$FLASHBACK_TIME\""       >> $PARFILE
echo "content=$CONTENT"                         >> $PARFILE
echo "schemas=$SCHEMAS"                         >> $PARFILE
echo "parallel=$PARALLEL"                       >> $PARFILE
echo "filesize=$FILESIZE"                       >> $PARFILE
echo "query=${QUERY1}"                          >> $PARFILE
echo "query=${QUERY2}"                          >> $PARFILE


Last edited by joeyg; 03-14-2011 at 01:12 PM.. Reason: Please use CodeTags around data and scripts
# 2  
Old 03-14-2011
Try quoting the quotes inside QUERY1 like
Code:
QUERY1=ENDUR.SIM_BLOB:\"where sim_run_id in (select sim_run_id from sim_header where run_time >= ...

Otherwise the shell assumes the quotes are meant for it, and handles them itself.
# 3  
Old 03-14-2011
Quote:
QUERY2="ENDUR.SIM_HEADER:"where run_time >= trunc(SYSDATE -5) or trunc(run_time) in ( trunc(sysdate,'mm')-1, trunc(add_months(sysdate,-1),'mm')-1)"
The above line contains three double quote characters and gives a syntax error in my Shell. If you don't get a syntax error you may have another unmatched quote somewhere in the script. I'd remove the middle of the three.

It's not clear what you what value you want.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Forum Support Area for Unregistered Users & Account Problems

Losing the connection

Hi. Recently when I'm logged in to site after some seconds, for instance, I lose the connection and need sign in again. It happens on Firefox and Chrome. Or another example, when I'm logged in to site and click on my nick name (right up corner) I lose the connection to site. User: tiago ... (0 Replies)
Discussion started by: Unregistered
0 Replies

2. Shell Programming and Scripting

Replace Double quotes within double quotes in a column with space while loading a CSV file

Hi All, I'm unable to load the data using sql loader where there are double quotes within the double quotes As these are optionally enclosed by double quotes. Sample Data : "221100",138.00,"D","0019/1477","44012075","49938","49938/15043000","Television - 22" Refurbished - Airwave","Supply... (6 Replies)
Discussion started by: mlavanya
6 Replies

3. Shell Programming and Scripting

Issue with Single Quotes and Double Quotes for prompt PS1

Hi, Trying to change the prompt. I have the following code. export PS1=' <${USER}@`hostname -s`>$ ' The hostname is not displayed <abc@`hostname -s`>$ uname -a AIX xyz 1 6 00F736154C00 <adcwl4h@`hostname -s`>$ If I use double quotes, then the hostname is printed properly but... (3 Replies)
Discussion started by: bobbygsk
3 Replies

4. Shell Programming and Scripting

Having a terrible problem with quotes/single quotes!

Hello. I'm trying to write a bash script that uses GNU screen and have hit a brick wall that has cost me many hours... (I'm sure it has something to do with quoting/globbing, which is why I post it here) I can make a script that does the following just fine: test.sh: #!/bin/bash # make... (2 Replies)
Discussion started by: jondecker76
2 Replies

5. Emergency UNIX and Linux Support

losing ESSID

Hey guys, facing a weird issue - hoping someone might be able to help. The wireless network on my laptop is configured with a static IP address. (not using nm) When i take the laptop out of the range (or i power the router down) the essid is becoming "off/any". When i'm back in range the... (6 Replies)
Discussion started by: moshe88
6 Replies

6. UNIX for Dummies Questions & Answers

grep single quotes or double quotes

Unix superusers, I am new to unix but would like to learn more about grep. I am very familiar with regular expressions as i have used them for searching text files in windows based text editors. Since I am not very familiar with Unix, I dont understand when one should use GREP with the... (2 Replies)
Discussion started by: george_vandelet
2 Replies

7. Shell Programming and Scripting

Losing zero in while read

I'm using a while read statement to read in lines from a file, if a value (for example) is 1000.10 in a field, the last zero is removed leaving 1000.1 does anyone know a way to keep the field as it is in the original file? (1 Reply)
Discussion started by: gefa
1 Replies

8. Shell Programming and Scripting

Single quotes and double quotes

Hi guys, I have a sed line in double quotes which works fine, but I want it to be in single quotes here is the sed line sed "/abc_def/s/\'.*\'/\'\${abc_def}\'/" can some one give the equivalent to the above script in single quotes Thanks a ton (5 Replies)
Discussion started by: sol_nov
5 Replies

9. Shell Programming and Scripting

Double quotes or single quotes when using ssh?

I'm not very familiar with the ssh command. When I tried to set a variable and then echo its value on a remote machine via ssh, I found a problem. For example, $ ITSME=itsme $ ssh xxx.xxxx.xxx.xxx "ITSME=itsyou; echo $ITSME" itsme $ ssh xxx.xxxx.xxx.xxx 'ITSME=itsyou; echo $ITSME' itsyou $... (3 Replies)
Discussion started by: password636
3 Replies

10. UNIX for Dummies Questions & Answers

losing time

Hi all, The server seems to be losing time, not a lot, but enough to be noticed. UNIX AIX 4.3.3 Any ideas, Kathy (9 Replies)
Discussion started by: kburrows
9 Replies
Login or Register to Ask a Question