December 27th, 2012, 11:09 PM
How to use Local Variables in unix?
i have created the below UNIX script to learn how to use Variables, however the output is blank. could anyone let me know what is wrong with the below script please.
# test script
set Var1 = "Test"
December 28th, 2012, 01:17 AM
you don't need to use set.
working example is this
December 28th, 2012, 04:37 AM
Thanks DonR, tried using the code you advised, i get the following error
Originally Posted by DonR
./t_script: line 3: Var1: command not found
December 28th, 2012, 04:48 AM
I susoect you will have spaces in the line ..
(exaggaerated number of spaces to make it clear!)
where it shoule not have spaces:
Comments on this post
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc
December 28th, 2012, 04:57 AM
Thanks Simon1, you are correct.. i removed the spaces and it worked
Originally Posted by SimonJM
DonR - Sorry did not notice that your code excluded the blank spaces.. if i had to literally copy and paste it would have worked
Last edited by clinton_eg; December 28th, 2012 at 05:03 AM.
Reason: Added a comment to DonR