• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: truncate the hostname of local computer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: truncate the hostname of local computer


  • Subject: Re: truncate the hostname of local computer
  • From: Martin Orpen <email@hidden>
  • Date: Fri, 10 Dec 2004 08:54:20 +0000

on 10/12/04 12:13 am, Steve Ingram wrote:

> In a script we are using to reset the computer name I have the line:
>
> set computerNameNoChange = `/bin/hostname`
>
> This gives me a value of ghs27038.local
>
> This is close to what I want. How do I get computerNameNoChange to
> equal only the first eight characters of /bin/hostname ?
>
> More precisely, how do I get computerNameNoChange to be the value of
> the current computer name, without the ".local" added?

As you are already using the shell you can pipe the result to cut:

    /bin/hostname | cut -d. -f1

So that you do it all in one line.

--
Martin Orpen


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: truncate the hostname of local computer
      • From: Steve Ingram <email@hidden>
References: 
 >truncate the hostname of local computer (From: Steve Ingram <email@hidden>)

  • Prev by Date: folder actions..
  • Next by Date: Hide process --> fullscreen game
  • Previous by thread: Re: truncate the hostname of local computer
  • Next by thread: Re: truncate the hostname of local computer
  • Index(es):
    • Date
    • Thread