This code doesnt work properly, it gives an error about the two variables, i am using bash in Linux mint 10(32bit), every time i try declare variables COLOR and VALUE i get an error that says "Command not found:
#!/bin/bash
COLOR = "Black"
VALUE = "9"
printf "Hi, "$USER
printf "\nlist of connected users: \n"
w
printf "This is a string: " $COLOR
printf "\nAnd this is a number: " $VALUE
printf "\n"
printf "\nScript finished\n"
3 replies to this topic
#1
Posted 26 June 2011 - 10:41 AM
|
|
|
#2
Posted 26 June 2011 - 11:54 AM
you need to remove the spaces
COLOR="Black"
LSST v1.05r3 > Chapter 2 > Rules for Naming variable name (Both UDV and System Variable)
COLOR="Black"
LSST v1.05r3 > Chapter 2 > Rules for Naming variable name (Both UDV and System Variable)
#3
Posted 26 June 2011 - 02:07 PM
Ah yes, variable assignment is done with no spaces, variable comparison is done with spaces.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#4
Posted 27 June 2011 - 12:02 AM
Oh, I see, thanks guys
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









