From 604ac1c422a1730afd5ed39fa57d2522d47185b5 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Thu, 16 Dec 2010 00:25:41 +0100 Subject: [PATCH] parallel.pod: Elaboration on QUOTING --- src/parallel.pod | 74 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 65 insertions(+), 9 deletions(-) diff --git a/src/parallel.pod b/src/parallel.pod index 273218b1..3c529a72 100644 --- a/src/parallel.pod +++ b/src/parallel.pod @@ -1590,28 +1590,84 @@ B is very liberal in quoting. You only need to quote +characters that have special meaning in shell: + +( ) $ ` ' " < > ; | \ + +and depending on context these needs to be quoted, too: + +* ~ & # ! ? space * { + +When you want to use a shell variable you need to quote the +$-sign. Here is an example using $PARALLEL_SEQ. This variable is set +by GNU B itself, so the evaluation of the $ must be done by +the sub shell started by GNU B: + +B + +If the variable is set before GNU B starts you can do this: + +B + +B + +Prints: B + +If the variable should not be evaluated by the shell starting GNU +B but be evaluated by the sub shell started by GNU +B, then you need to quote it: + +B + +Prints: B + +$$ is the shell variable containing the process id of the shell. This +will print the process id of the shell running GNU B: + +B + +And this will print the process ids of the sub shells started by GNU +B. + +B + +If the special characters should not be evaluated by the sub shell +then you need to protect it against evaluation from both the shell +starting GNU B and the sub shell: + +B + +Prints: B + +GNU B can protect against evaluation by the sub shell by +using -q: + +B + +Prints: B + +This is particularly useful if you have lots of quoting. If you want to run a perl script like this: B -This can be done by GNU B using: +It needs to be quoted like this: -B +B -Notice how \'s, "'s, and $'s needs to be quoted. GNU B can do -the quoting by using option B<-q>: +Notice how spaces, \'s, "'s, and $'s need to be quoted. GNU B +can do the quoting by using option -q: B -However, this means you cannot make the shell interpret special -characters. For example this B: +However, this means you cannot make the sub shell interpret special +characters. For example this WILL NOT WORK: B>B<{.}"> B>B<{.}.bz2"> -because > and | need to be interpreted by the shell. +because > and | need to be interpreted by the sub shell. If you get errors like: