hunter@oakhill.UUCP (Hunter Scales) (09/24/90)
Does anyone know how to force csh to leave the quotes on args
and pass them down to a command?
I.e., I need to call a command like so:
foo "this is an argument"
from a shell. I have tried this:
set string = "this is an argument"
foo "$string"
and I get:
foo this is an argument
how can I force it leave the quotes on?
--
Motorola Semiconductor Inc. Hunter Scales
Austin, Texas {harvard,utah-cs,gatech}!cs.utexas.edu!oakhill!hunter
#include <disclaimer.h>karl_kleinpaste@cis.ohio-state.edu (09/25/90)
hunter@oakhill.uucp writes:
Does anyone know how to force csh to leave the quotes on args
and pass them down to a command?
You have to quote the quoting. Either
set string = '"this is an argument"'
where single-quotes preserve everything literally, or if you have a
grotesque fascination for backslashes,
set string = \"this\ is\ an\ argument\"
where backslash forces the following character to be interpreted as an
ordinary character.
Double quotes preserve whitespace in a string and prevent globbing
(that is, wildcard matching of *?[]) but permit interpolation of
variables; single quotes cause no interpretation at all.
--karljms@romana.Tymnet.COM (Joe Smith) (09/27/90)
In article <3883@cerberus.oakhill.UUCP> hunter@oakhill.UUCP (Hunter Scales) writes: > set string = "this is an argument" > foo "$string" >does not produce the same thing as > foo "this is an argument" set string='"variable with double quote characters inside it"' foo "$string" or set string="variable consisting of several words, no quotes" foo '"'"$string"'"' Strings with different types of quotes can be concatinated together. -- Joe Smith (408)922-6220 | SMTP: jms@tardis.tymnet.com or jms@gemini.tymnet.com BT Tymnet Tech Services | UUCP: ...!{ames,pyramid}!oliveb!tymix!tardis!jms PO Box 49019, MS-C41 | BIX: smithjoe | 12 PDP-10s still running! "POPJ P," San Jose, CA 95161-9019 | humorous dislaimer: "My Amiga 3000 speaks for me."