Sponsored Content
Full Discussion: Escaping ** correctly
Top Forums Shell Programming and Scripting Escaping ** correctly Post 302394787 by brsett on Friday 12th of February 2010 02:17:30 PM
Old 02-12-2010
Quote:
Originally Posted by Corona688
The problem is that you can't put quoted strings inside variables and expect them to get split sanely AFTER substitution has already happened. It'll split apart on spaces but not much else. It doesn't re-check for quoted strings etc. after substitution's already happened. So your script isn't being given **, it's being given '**', quotes and all! And yet, if you remove the quotes, it WILL substitute for *, even though it doesn't substitute for strings...

Put them in an array so there's no guessing at all involved in which parts are string, which parts are quotes, and where it should split them apart; it'll do so just like you'd expect of program arguments. There's a magic syntax to spit out an entire array as properly separated parameters too.

Code:
ARGS=( --include /home --exclude "**" )
# This array syntax spits out an array, splitting ONLY between elements.
program "${ARGS[@]}"

This won't work in ordinary sh, which doesn't have arrays.
Thanks, that's got it fixed.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Escaping '*' in Bash

I have the following situation ============ export DirectoryName=/tmp/xyz if ; then some_new_env=$DirectoryName"/*" ======================= I tried all the ways of escaping the '*', but still the shell seems to expand the '*' character. I want some_new_env to contain "/tmp/xyz/*" ... (7 Replies)
Discussion started by: rkshukla14
7 Replies

2. Shell Programming and Scripting

escaping single quote

hi, echo 'abc' will give output abc how can i get output as 'abc' plz help. thanks in advance (3 Replies)
Discussion started by: javeed7
3 Replies

3. Shell Programming and Scripting

Escaping the * character in ksh.

Hi All, In ksh script i'm trying to assign "sqlstmt1" varaible value, update VAREntryTb set VAR10num = VAR1num * Mltplr where BusD = '$val1' and RunI = 1"` Hence i wrote below statement, the issue with this is shell is expanding "*" character adn thus subistuting it with the content of my... (6 Replies)
Discussion started by: arvindcgi
6 Replies

4. UNIX for Dummies Questions & Answers

Escaping backslash

I have a variable containt something like this, c:\mask\mask. How can I escape "\" in the values? I want the value as it it. (9 Replies)
Discussion started by: swmk
9 Replies

5. UNIX for Dummies Questions & Answers

Escaping comma with \ in file

Hi, I have pipe delimited file in which some of the description fields can have commas. e.g. 1|123|abc,def 2|456|qwert 3|345|aty,try,rty I need to convert this to a 'csv' file BUT i need to add \ before every comma present in the description values (so that my next program can read it as... (3 Replies)
Discussion started by: dsrookie
3 Replies

6. Shell Programming and Scripting

escaping '

I'm cleaning this from some html files style='' but when I try 's/style=\'\''//' I get an unmatched ' error (4 Replies)
Discussion started by: dba_frog
4 Replies

7. Shell Programming and Scripting

escaping path

Hi I use : path=/var/www/admin echo "$path" | sed -e 's/\//\\\//g' this return \/var\/www\/admin and is ok. but path2=`echo "$path" | sed -e 's/\//\\\//g'` echo $path2 return an error: sed: -e expression #1, char 9: unknown option to `s' Can anyone help me? Thanks (3 Replies)
Discussion started by: georgian
3 Replies

8. Shell Programming and Scripting

Escaping the \

So I understand that I should be able to ouput a literal \ by escaping it with a preceding \. My problem is that I am trying to ouput a script that will subsequently be run on a different system with UNC pathing, so I want to ouput two \\ in a row, but escaping them both in sequential order is not... (4 Replies)
Discussion started by: JourneyRider
4 Replies

9. UNIX for Beginners Questions & Answers

Gawk Escaping Ampersand

I would like to open a text m3u file and add the same string to the beginning of each line. I think I am close, but I cannot figure out how to escape the ampersand in the following code: gawk-3.1.6.exe "{print /var/media/Music2.0TB2.1USB/Audio Files/Music/Rock & Roll/ $0}" "L:\Music\Rock &... (7 Replies)
Discussion started by: WarpLover
7 Replies

10. Shell Programming and Scripting

Escaping Forward Slash

./split2.sh: line 1: split/ssl/pop3s.txt: No such file or directory sort: cannot read: split/ssl/pop3s.txt: No such file or directory Hi there, I am pulling data from the following source: ssl/http ssl/http ssl/http-alt ssl/https ssl/https ssl/https ssl/https ssl/https ssl/https... (3 Replies)
Discussion started by: alvinoo
3 Replies
PAPS(1) 						      General Commands Manual							   PAPS(1)

NAME
paps - UTF-8 to PostScript converter using Pango SYNOPSIS
paps [options] files... DESCRIPTION
paps reads a UTF-8 encoded file and generates a PostScript language rendering of the file. The rendering is done by creating outline curves through the pango ft2 backend. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. --landscape Landscape output. Default is portrait. --columns=cl Number of columns output. Default is 1. Please notice this option isn't related to the terminal length as in a "80 culums terminal". --font=desc Set the font description. Default is Monospace 12. --rtl Do right to left (RTL) layout. --paper ps Choose paper size. Known paper sizes are legal, letter and A4. Default is A4. Postscript points Each postscript point equals to 1/72 of an inch. 36 points are 1/2 of an inch. --bottom-margin=bm Set bottom margin. Default is 36 postscript points. --top-margin=tm Set top margin. Default is 36 postscript points. --left-margin=lm Set left margin. Default is 36 postscript points. --right-margin=rm Set right margin. Default is 36 postscript points. --gutter-width=gw Set gutter width. Default is 40 postscript points. --help Show summary of options. --header Draw page header for each page. --markup Interpret the text as pango markup. --lpi Set the lines per inch. This determines the line spacing. --cpi Set the characters per inch. This is an alternative method of specifying the font size. --stretch-chars Indicates that characters should be stretched in the y-direction to fill up their vertical space. This is similar to the texttops behaviour. AUTHOR
paps was written by Dov Grobgeld <dov.grobgeld@gmail.com>. This manual page was written by Lior Kaplan <kaplan@debian.org>, for the Debian project (but may be used by others). April 17, 2006 PAPS(1)
All times are GMT -4. The time now is 02:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy