[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how do I split variables?
From: |
Chet Ramey |
Subject: |
Re: how do I split variables? |
Date: |
Fri, 22 Sep 2000 10:51:59 -0400 |
> this is actually more a question, less a bug. But help would be
> appreciated...
>
> I'm having some trouble with a script:
>
> $FILE (contains recvq/fax00044.tif, for example. the number rises by 1,
> everytime a fax is recieved)
> I want to change the value of $FILE(recvq/fax00044.tif) to
> recvq/someuser/fax00044.tif.....
> Since there is no way to change $FILE's value, there must be some special
> wordsplit function or so........
If you can guarantee that there will be only a single slash, you can use
FILE1=${FILE%%/*}/someuser/${FILE##*/}
If not, you can set IFS=/, split $FILE, and pick out the parts you need.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)
Chet Ramey, CWRU chet@po.CWRU.Edu http://cnswww.cns.cwru.edu/~chet/
- Re: how do I split variables?,
Chet Ramey <=