LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-19-2011, 02:15 PM   #1
alexa-lol
LQ Newbie
 
Registered: May 2011
Distribution: Ubuntu
Posts: 8

Rep: Reputation: Disabled
HOSTNAME variable is being an empty string


hej
The script produces 2 empty lines and I don't know why.

#!/bin/bash

echo $HOSTNAME
echo $PATH
echo $OSTYPE
echo $LANG

produces

jaka@jaka-System-Product-Name:~$ sh host.sh

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

sl_SI.UTF-8

Variables $HOSTNAME and $OSTYPE are an empty string. Is this OK?

Cheers

EDIT
It seems to work now and I dont know why it didnt work before.

Last edited by alexa-lol; 05-19-2011 at 04:13 PM.
 
Old 05-20-2011, 07:15 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Glad it started working for you If it stops working you can remove the SOLVED from this thread and post again.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] replace string with empty string of dir path ted_chou12 Linux - Newbie 3 04-02-2011 06:43 AM
[SOLVED] [BASH] non-empty variable before loop end, is empty after exiting loop aitor Programming 2 08-26-2010 09:57 AM
getopts empty variable felix001 Programming 2 05-12-2010 02:37 AM
Help: removing a variable substring from a string variable in sh script gnparsons Programming 2 06-04-2008 05:21 PM
hostname command vs. $HOSTNAME env. variable Silly22 Linux - Networking 2 03-29-2002 05:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration