From owner-freebsd-chat Thu Feb 27 04:36:26 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id EAA23010 for chat-outgoing; Thu, 27 Feb 1997 04:36:26 -0800 (PST) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id EAA23003 for ; Thu, 27 Feb 1997 04:36:23 -0800 (PST) Received: (from msmith@localhost) by genesis.atrad.adelaide.edu.au (8.8.5/8.7.3) id XAA03536; Thu, 27 Feb 1997 23:06:07 +1030 (CST) From: Michael Smith Message-Id: <199702271236.XAA03536@genesis.atrad.adelaide.edu.au> Subject: Re: Autocreate script In-Reply-To: from Vincent Poy at "Feb 27, 97 02:58:11 am" To: vince@mail.MCESTATE.COM (Vincent Poy) Date: Thu, 27 Feb 1997 23:06:04 +1030 (CST) Cc: chat@freebsd.org X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-chat@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Vincent Poy stands accused of saying: > I'm currently working on the autocreate script...looks good so > far. I was wondering if anyone knew of a way to convert strings. > > Let's say $string is "SomeLongUserName" > I want to convert that to "SomeLong" > > so it would be a valid username. > > Any ideas? $ string=SomeLongUserName $ echo "puts [string range $string 0 7]" | tclsh SomeLong or for the minimalists amongst us : $ echo $string | cut -c 1-8 SomeLong (I presume you're using sh here, of course not having told us that you could be accused of wasting our time...) > Vince - vince@MCESTATE.COM - vince@GAIANET.NET ________ __ ____ > Unix Networking Operations - FreeBSD-Real Unix for Free / / / / | / |[__ ] -- ]] Mike Smith, Software Engineer msmith@gsoft.com.au [[ ]] Genesis Software genesis@gsoft.com.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control. (ph) +61-8-8267-3493 [[ ]] Unix hardware collector. "Where are your PEZ?" The Tick [[