December 28th, 2012, 12:09 AM
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, 02:17 AM
you don't need to use set.
working example is this
December 28th, 2012, 05: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, 05: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, 05: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 06:03 AM.
Reason: Added a comment to DonR