Suppose I had a directory name of company.domain.com

where company was diff everytime.

How could I read the company part of the name in as one of the variables in my bash script?

Recommended Answers

is this what you want
read INUPT
the user enters company@gmail.com
you want INPUT to equal just 'company'

Jump to Post

All 3 Replies

is this what you want
read INUPT
the user enters company@gmail.com
you want INPUT to equal just 'company'

no the directory is auto created by the control panel.
'

the directory would be "company.domain.com"


I need to be able to read the "company' part of the directory with no user input at all.

almost like a pwd that dissects the directory name.

Chris

I can be a little slow understanding stuff, is this what you mean

shane@mainbox shane $ input=company.domain.com
shane@mainbox shane $ echo $input | sed "s/.domain.com//"
company
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.