Results 1 to 8 of 8
Hi, as Newbie i have a stupid question that i am sure everybody but me, knows the answer.
Why the variable $LINE, if echoed from command line, gives the correct ...
- 07-10-2007 #1Just Joined!
- Join Date
- Jun 2007
- Posts
- 5
Stupd question about environment variable
Hi, as Newbie i have a stupid question that i am sure everybody but me, knows the answer.
Why the variable $LINE, if echoed from command line, gives the correct number of lines of the screen, but if echoed within a script it gives a blank value?
Thank you
Gabe
- 07-10-2007 #2
My guess is the subshell that a script is executed in doesn't have any real lines to it.
- 07-10-2007 #3Just Joined!
- Join Date
- Jun 2007
- Posts
- 5
- 07-24-2007 #4
- 07-24-2007 #5Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
Have you tried exporting the variable so it's inherited by subshells?
- 07-25-2007 #6
This would work, however I'm not sure how viable of a solution it is.
- 07-25-2007 #7Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
Well, the problem Lele wanted to solve was how to get the value of the LINE var in a subshell, so if it works, it's viable! Whether it's the solution to the real problem, of course ....
- 07-25-2007 #8
Well, running export LINES; export COLUMNS before running the script everytime would kind of not be cool. You could add -i as an argument to bash at the top of your script, that would probably give you LINES and COLUMNS.


Reply With Quote
