to quote or not to quote?

to quote or not to quote?

Post by Fuzzy F » Sun, 05 Sep 1993 16:07:31




Quote:>echo scriptx ''\''$PWD $OPWD'\''' | at -m -qn now + 1 minute
>which outputs to 'at'
>scriptx '$PWD $OPWD'
>I understand how '/'' produces a ', but why doesn't the first '' equate to
>null?

It does equate to null.  You can leave out the '' pairs without
changing the result:

echo scriptx \''$PWD $OPWD'\'

Quote:> My other question is there a way to have 'at' execute immediately
>instead of the 1 minute wait (without specifying an absolute time)?

If you want to execute the command immediately, why not just execute it
instead of sending it to 'at'?

--

        "This life is a test.  It is only a test.  Had this
         been an actual life, you would have received further
         instructions as to what to do and where to go."

 
 
 

to quote or not to quote?

Post by Allan Dong » Sun, 05 Sep 1993 00:30:19


Could someone explain quoting to me?  From within a program, I need to pass
strings with embedded spaces and $ as parameters to 'at' and the subsequent
shell script that 'at' executes.

At the unix prompt, I have tried:

echo scriptx ''\''$PWD $OPWD'\''' | at -m -qn now + 1 minute

which outputs to 'at'

scriptx '$PWD $OPWD'

I understand how '/'' produces a ', but why doesn't the first '' equate to
null?  My other question is there a way to have 'at' execute immediately
instead of the 1 minute wait (without specifying an absolute time)?

Thanks in advance,

--

Sierra Systems Consultants                Work: (604) 385-1535
Victoria, B.C., Canada    

 
 
 

to quote or not to quote?

Post by Lawrence Kir » Sun, 05 Sep 1993 20:21:08



>Could someone explain quoting to me?  From within a program, I need to pass
>strings with embedded spaces and $ as parameters to 'at' and the subsequent
>shell script that 'at' executes.

>At the unix prompt, I have tried:

>echo scriptx ''\''$PWD $OPWD'\''' | at -m -qn now + 1 minute

>which outputs to 'at'

>scriptx '$PWD $OPWD'

>I understand how '/'' produces a ', but why doesn't the first '' equate to
>null?

It does. Scanning the line you get:

  ' - enter quote mode
  ' - leave quote mode
 \' - output a quote but don't enter quote mode
  ' - enter quote mode
  $PWD $ OPWD - output text (we're in quote mode so don't interpret it).
  ' - leave quote mode
 \' - output a quote but don't enter quote mode
  ' - enter quote mode
  ' - leave quote mode

So all that is output is '$PWD $OPWD' and the initial and final quote pairs
do absolutely nothing.

Quote:> My other question is there a way to have 'at' execute immediately
>instead of the 1 minute wait (without specifying an absolute time)?

You could try batch instead of at. This is a good method of starting something
in the background which will continue executing after you have logged off.

-----------------------------------------


-----------------------------------------

 
 
 

1. Quotes in quotes

The backup command bru takes an optional Label argument like this:

bru -L "Useful label information" -cvf /dev/nst0 /dir1

In a sh script I'm writing I want to take /dir from the command line
(easy) and put it into the label field with the time. Something along the
lines of:

#!/bin/sh
DIR=$1
LABEL="$(date) $DIR"
BRUCMD="bru -L $LABEL -cvf /dev/nst0 $DIR"

echo $BRUCMD

$BRUCMD

the echo gives back exactly what I want to see:

bru -L "Fri Jun 12 20:59:42 EDT 1998 /dir1" -cvf /dev/nst0 /dir1

but when the command executes the quote marks have disappeared and bru
chokes on everything after Fri.

I'm sure this is something quite simple I'm missing, but I've already
wasted too much time on it.

Any suggestions?

thanks in advance,
Matt

2. WWW Browser Recommedation?

3. Q: sh: Can I quote '"' in a double quoted string?

4. Solarix x86 OpenGL?

5. replace single quote to double quote with an example

6. uptime > cgi |web browser

7. quoted strings within quoted strings

8. pattern matching question

9. Quoting quotes in m4?

10. Double quotes within double quotes (no apostrophes)

11. Problem in sed using double quotes and single quotes

12. quoting quotes withion a (bourne shell) script line

13. quoting quotes, problem