Google Answers Logo
View Question
 
Q: simple tcsh script ( No Answer,   1 Comment )
Question  
Subject: simple tcsh script
Category: Computers
Asked by: mickr-ga
List Price: $10.00
Posted: 11 Jul 2006 08:18 PDT
Expires: 10 Aug 2006 08:18 PDT
Question ID: 745297
I want to convert a string like (a,b,c) into a list a b c in tcsh

In tcl I would expect to do something like

set a "a,b,c"
set b [split $a ,]
llength $b <would return 3>

How do I do this in tcsh?
Answer  
There is no answer at this time.

Comments  
Subject: Re: simple tcsh script
From: bcwhite-ga on 17 Jul 2006 10:32 PDT
 
Most shells don't do too much built-in; they rely on calling outside programs.

 setenv a "a,b,c"
 setenv b `echo $a | sed -e 's/,/ /g'`
 echo $b

In my experience, csh is not a good scripting language.  If you have
the option, I suggest looking at /bin/sh instead.  It's standard (on
all unix), more powerful, and has better extensions (i.e. "bash").  If
you still need more power, go to perl.

-- Brian

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy