>Hi All,
>I have a question regarding Korn shell scripting:
>STR_VAR="This is a test for Bob Allen"
>I want to write a script to output the following:
>This is a test for Bob Allen and Bob Allen only.
>So I write:
>#!/bin/ksh
>echo "$STR_VAR"
>will give me "This is a test for Bob Allen", retaining
>the multiple blank spaces between Bob and Allen. How do
>I get the "and Bob Allen only." afterwards? I tried:
>echo "$STR_VAR" `echo "$STR_VAR" | cut -c20-30` "only."
>but I got:
>This is a test for Bob Allen and Bob Allen only.
processed as word delimiters:
echo "$STR_VAR" "`echo \"$STR_VAR\" | cut -c20-30`" "only."
Another way is to use a separate variable:
SUBSTR=`echo "$STR_VAR" | cut -c20-30`
echo "$STR_VAR" "$SUBSTR" "only."
P.S. Where is your "and" comming from?
--
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Don't bother cc'ing followups to me.