Results 1 to 4 of 4
Hi!
I'm newbie in Linux & Scripting. I have a script file:
#
# print prompt settings
#
clear
echo "Prompt Settings: $PS1"
echo "Number of lines on the screen: ...
- 07-01-2010 #1Just Joined!
- Join Date
- Jul 2010
- Posts
- 2
Need help in printing System variables: $PS1, $LINES, $COLUMNS
Hi!
I'm newbie in Linux & Scripting. I have a script file:
#
# print prompt settings
#
clear
echo "Prompt Settings: $PS1"
echo "Number of lines on the screen: $LINES"
echo "Number of columns on the screen: $COLUMNS"
exit 0
But I don't know I can't print out the values of $PS1, $LINES, $COLUMNS.
Please help me
Thank you.
- 07-01-2010 #2Linux Newbie
- Join Date
- Apr 2007
- Posts
- 119
Look up a "scripting howto" or something similar such as this.
- 07-01-2010 #3Linux Newbie
- Join Date
- Mar 2009
- Posts
- 228
I assume you ran the script with either:
./script.sh
or
sh script.sh
Problem here is that a child process is created to run the script and those system variables don't exist in child processes since they're not needed. You'd have to run it in the current shell process which is done with:
source script.sh
WARNING: You're 'exit 0' command will log you off. Better to comment that out first.
- 07-02-2010 #4Just Joined!
- Join Date
- Jul 2010
- Posts
- 2


Reply With Quote
