can't run text file

Asked by Frank Mcquaid

I have made a text file called prompt.
It contains:
PS1='\n\u: '

This is to change the terminal prompt.
I know this can be done in a file, but I am too new at this game to be messing around with files I dont understand yet.

When the file runs the terminal window comes up and then quickley disappears
What else do I need in the file to keep the window open.

Thanks for any help you can give.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gnome-terminal Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:
Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#1

If you add the line at the bottom of:

~/.bashrc

It will apply for you

Revision history for this message
Alessandro Menti (elgaton) said :
#2

1) To leave the terminal open, you could put this line at the end:
read junk;
This command is normally used to prompt the user for some text and store it into a variable (in this case, "junk"). Its side effect is keeping the shell open until you press Enter.
2) Putting the command in a text file has, unfortunately, no definitive effect on the prompt, as it is changed only as long as the shell running the script is open. If you want to change the prompt in all shells once and for all, add the line you mentioned at the end of the ".bashrc" file in your home directory. (Notice the filename begins with a dot, meaning it will not be listed normally in your file manager, although it's there).

Revision history for this message
Frank Mcquaid (fmcquaid77) said :
#3

I added the command ~/.bashrc to the end text file but had no effect.
I went to the home directory and used gedit ~/.bashrc .
Placed the PS1='\n\u: ' at the end file, saved and it works perfectly

Thank you very much

Revision history for this message
Frank Mcquaid (fmcquaid77) said :
#4

I added the command ~/.bashrc to the end text file but had no effect.
I went to the home directory and used gedit ~/.bashrc .
Placed the PS1='\n\u: ' at the end file, saved and it works perfectly

Thank you very much

Revision history for this message
Frank Mcquaid (fmcquaid77) said :
#5

Thanks actionparsnip, that solved my question.