WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: scripting with hostname  (Read 1576 times)

Offline remus

  • Sr. Member
  • ****
  • Posts: 371
scripting with hostname
« on: September 25, 2014, 12:51:09 AM »
Hi all,

I'm writing a bash script to do a backup, and am wondering how I use the hostname in a bash script in tinycore.

If I type hostname enter from the prompt, I get the following.

Code: [Select]
$ hostname
backserver

However I have had no luck using it in my script. I just want to echo the hostname of the server running the script into a log file, that has some other stuff in it.

Any suggestions and comments welcome.

Thanks.
Live long and prosper.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11518
Re: scripting with hostname
« Reply #1 on: September 25, 2014, 01:33:04 AM »
Hi remus
This will append the hostname to the end of filename.log:
Code: [Select]
hostname >> filename.log