by juliana cheng on Sun Dec 01, 2013 11:06 pm
[quote="Rich Simms"][b]PS1="\t"[/b] [i][color=#00BFFF]will work in the parent shell.[/color][/i]
[b]echo -e "$PWD $PS1=`\t: `"[/b] [i][color=#00BFFF]won't work in either the parent or child process.[/color][/i]
The reason the first one doesn't work in the script is because your script runs as a child process. The child process is not allowed to make changes to the parent's variables. I'm not sure what you are tyring to do in the second line.
Some experiments to try:
1) Replace the second line with the first line above in your script. Immediately after it echo the new value of PS1 with something like:
[b]echo "PS1 has been set to $PS1"[/b]. When you run your script now you should see the child's PS1 variable assigned the prompt code for time. However this will not change the value of the PS1 variable owned by the parent.
2) If that works, then trying sourcing your script so it does not run as a child process.
Use:
[b]. myscript.v5[/b]
or
[b]source myscript.v5[/b]
Now when your script runs it will change the parent's prompt.[/quote]
It is so difficult to type in something here for I cannot see what I am typing..the screen is jumping up and down while Itpe!
Anyway, I found it pretty neat to change the home directory command to a digital clock as a prompt so I came up with the idea to put that into the PS1="\t" as one of the final roject task..with perhaps whomever classmate who logged in and try it to give an out put of==> 12:23:54: you the person logged in chejul you are clocked!
juliana and the ditigial clock changes like a real clock's time as the prompt!