WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: scripting with hostname  (Read 932 times)

Offline remus

  • Sr. Member
  • ****
  • Posts: 369
scripting with hostname
« on: September 24, 2014, 09:51:09 PM »
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

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.

Live long and prosper.

Offline Rich

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