Results 1 to 3 of 3
I suspect it is not possible, but just not sure why..
my PS1 is defined as my_login_name@hostname:current_path
using the script did not show anything
#!/bin/sh
PROMT_PATH=`echo $PS1`
echo $PROMPT_PATH
using ...
- 03-17-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 3
capture the PS1 value from a script
I suspect it is not possible, but just not sure why..
my PS1 is defined as my_login_name@hostname:current_path
using the script did not show anything
#!/bin/sh
PROMT_PATH=`echo $PS1`
echo $PROMPT_PATH
using perl did not help
#!/usr/bin/perl
$current=$ENV{PS1}; print ("$current")
any idea to make it work?
thanks
- 03-17-2009 #2
- 03-18-2009 #3Just Joined!
- Join Date
- Mar 2009
- Posts
- 6
PS1 environment variable is defined in /etc/profile, which is for login shell. When you put it into your script file and execute it, it's in non-login shell.


Reply With Quote