LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-08-2014, 10:11 PM   #1
CrazyCatLover
Member
 
Registered: Jan 2014
Posts: 39

Rep: Reputation: Disabled
Random envionment variables


Hi,
1.typing env shows the environment variables
2.$RANDOM is an environment varible
So why doesnt typing env shows the $RANDOM environment varible?
 
Old 11-08-2014, 10:17 PM   #2
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Because it's not an environmental variable?
 
Old 11-10-2014, 12:11 PM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
$RANDOM is special. You can echo it but it's not part of the environment:
Code:
$ echo $RANDOM
32408
$ env | grep RANDOM
$
 
Old 11-10-2014, 01:17 PM   #4
Soderlund
Member
 
Registered: Aug 2012
Posts: 185

Rep: Reputation: 81
$RANDOM is also not present in the old Heirloom shell. Bash, pdksh and probably most other modern shells have it. The other way of getting a random number is (for example):

Code:
hexdump -n 1 -e '/1 "%u"' /dev/urandom
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Trying to fill 100 variables with random numbers plisken Programming 8 04-26-2012 02:43 PM
Rename command using random variables? Springs Linux - General 1 04-14-2010 12:07 PM
Making Random Variables bioinformatics_guy Linux - Newbie 2 09-15-2008 07:09 AM
bash: random creation of multiple variables vicious1 Programming 3 04-23-2007 03:34 AM
How the system's envionment was build? docterling Linux - Newbie 1 03-10-2005 07:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:54 PM.

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