Date: Fri, 17 Dec 1999 17:34:52 +0200 From: Giorgos Keramidas <charon@hades.hell.gr> To: Dan Larsson <dl@tyfon.net> Cc: freebsd-questions@freebsd.org Subject: Re: howto tokenize string in sh Message-ID: <19991217173452.D363@hades.hell.gr> In-Reply-To: <01BF4873.C18DD540.dl@tyfon.net> References: <01BF4873.C18DD540.dl@tyfon.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Dec 17, 1999 at 09:47:38AM +0100, Dan Larsson wrote: | Having a string containing a path, what I need to do with it is to | determine if it is relative to current or not. | For this I imagine that splitting the path with the slashes as delimiters | to examine the tokens in between for a token containing two dots (..) is | one way of doing it. sed(1) is your friend. use something like: VARIABLE="`echo $DIRNAME | sed -e 's@/@ @g'`" then you can always use set $VARIABLE and use $1, $2 and so on for the parts of it, or something like: for component in $VARIABLE ;do echo $component done -- Giorgos Keramidas, <keramida@ceid.upatras.gr> "What we have to learn to do, we learn by doing." [Aristotle] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991217173452.D363>