Where could be the problem in this script?
#!bin/bash
NUMBER=$RANDOM
echo " The number is: $NUMBER"
when I start this script, it'll write this:
The number is:
(I am running Ubuntu 12.04)
If you are using a linux system you can get a random number out of /dev/random or /dev/urandom. Be carefull /dev/random will block if there are not enough random numbers available. If you need speed over randomness use /dev/urandom. These "files" will be filled with random numbers generated by the operating system.
$_ (dollar underscore) is another special bash parameter and used to reference the absolute file name of the shell or bash script which is being executed as specified in the argument list. This bash parameter is also used to hold the name of mail file while checking emails.
Symbol: $$ The symbol $$ stores the PID of the current shell. For example: #! /bin/bash. echo $$ In my case, it printed out the value 2443.
Because you have an error in your shebang, it should be :
#!/bin/bash
(note the missing /
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With