Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

gpchess2k

macrumors member
Original poster
Oct 12, 2015
42
0
Hello! Simple stupid question..... I cant seem to figure out for the life of me. I want to use the output of a command but trim it before using it as an alias.

Code:
scutil --get HostName

If output is: macbookpro123.internet.com

I would like to use this output as an alias without '.internet.com'.
 
Try this:

Code:
scutil --get HostName | sed 's/\..*//'

It will return the string to the left of the first .
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.