Questions about the BASH shell's PS1 input prompt facility. DO NOT USE this tag for questions about PowerShell scripts, use [powershell] instead.
Questions tagged [ps1]
285 questions
0
votes
1 answer
Bash: How to set changing variable in PS1, updating every prompt
I've searched for quite a while, but haven't been able to find a post or any information whatsoever about adding a variable that is, well, variable (i.e. changing) within PS1 in bash, that will update every time a new prompt occurs. In concreto, I…
![](../../users/profiles/5911808.webp)
7z.
- 75
- 1
- 5
0
votes
0 answers
windows task schduler keep showing 0x41301
I have wrote the following .ps1 file:-
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$request = [System.Net.WebRequest]::Create("https://localhost/")
$response = $request.GetResponse()
$response.Close()
and I set a…
![](../../users/profiles/1404577.webp)
John John
- 1,968
- 8
- 39
- 61
0
votes
1 answer
PS1 Command - Bash
I am trying to get the PS1 command working with bash.
What I am trying to do is capture the user's data and input it to change the field on the command line.
I know the command is PS1="MadMike", but what I am trying to do is the captured data from…
![](../../users/profiles/5884218.webp)
MadMike
- 9
- 1
0
votes
2 answers
Preventing 'process completed' after bashrc function in OS X
In my .bashrc file, I have the following lines:
alias cd='_cd'
function cd()
{
cd "$1"
PS1='[$USER] "$PWD" $ '
}
However, after sourcing my .bashrc, every time I try to run the command, I get a process completed message, and I am locked…
![](../../users/profiles/4526545.webp)
Patrick Gatewood
- 11
- 3
0
votes
1 answer
a Trouble with Android Terminal
Why terminal IDE (a terminal emulator for Android) doesn't execute some .sh files on my rooted Android device?(the error is: "permission denied")
I have typed this code in terminal:
su
sh dprompt.sh
and "dprompt.sh" contains this code:
export…
0
votes
1 answer
why my function does not execute in PS1?
get_git_branch(){
local branch__=
git branch &> /dev/null
if [ $? -eq 0 ]; then
branch__=`git branch --no-color | sed -ne 's/^\* \(.*\)$/\1/1p' | tr a-z A-Z`
else
branch__="NORMAL"
…
![](../../users/profiles/2822466.webp)
ggaaooppeenngg
- 1,047
- 1
- 10
- 22
0
votes
1 answer
__git_ps1 shows wrong branch
I'm getting an issue where the __git_ps1 script returns the wrong branch.
First, I'll check my branches:
ssalisbury@DOTWeb ssalisbury (master)$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
Then I'll create…
![](../../users/profiles/3246507.webp)
smsalisbury
- 185
- 2
- 14
0
votes
1 answer
Animated PS1 prompt BASH
I'm aware that this has been asked before but I couldn't find the answer I wanted anywhere. What I need (would like to have) is a BASH prompt that looks like this:
[ blah@blah ] >
[ blah@blah ] >
[ blah@blah ] >
(then the animation repeats)
Its…
![](../../users/profiles/4725378.webp)
QuaDECH
- 15
- 1
- 8
0
votes
2 answers
how to get the coordinate of cursor when setting PS1 variable for command line prompt?
I'm using Mac. I want to set PS1 variable to get current time at the end of line in command line prompt. Like this:
or this:
But, unfortunately, I can't get what I want through following configuration:
CYAN="\[$(tput setaf 6)\]"
GREEN="\[$(tput…
![](../../users/profiles/1391975.webp)
AngelIW
- 23
- 7
0
votes
0 answers
Rewriting commands from history causes pieces of command and PS1 to be deleted and cursor to move unexpectedly
I suspect this issue is related to my PS1 as I started experiencing these issues after changing it to (from my .bashrc):
export PS1="\[\e[1;36m\t\e[m \]\h:\W\$ "
So now when I try to edit a command from my history (either by pressing up-arrow or…
![](../../users/profiles/2162144.webp)
tytk
- 1,680
- 2
- 21
- 36
0
votes
1 answer
Powershell commands variables return empty in ps1 script
I'm trying to simply get some data into a variable (this s just an example of my issue, much bigger script in the works),
$var=get-physicaldisk
This works if I type it out in powershell, but if I try to script is with ps1 the variables never get…
![](../../users/profiles/4714595.webp)
Kilaj1
- 1
- 1
0
votes
1 answer
Custom PS1: usual PS1 for all directories excluding single directory with subdirectories
Consider fixed absolute path to some directory with arbitrary subdirectories:
/full/path/to/fixed/directory
/full/path/to/fixed/directory/first_subdirectory
/full/path/to/fixed/directory/first_subdirectory/second_subdirectory
and arbitrary other…
user1569844
0
votes
2 answers
Powershell Script from CSV
I am trying to make a script to put a bunch of information Active Directory. It imports the information from a csv file. The script errors out on City,State,Fax,mobile. The script is pretty in depth. I used several different sets of code together to…
![](../../users/profiles/4462958.webp)
Andrew
- 103
- 4
0
votes
2 answers
Powershell Add-content Out-File Text is wrong
When i use this:
"$LogTime $CurrentDate Invalid Archive Grouping selected. You selected '$ArchiveGrouping'" | Out-File $LogFile -Append -Force
To write to a file i generated with this code:
$Logdate = Get-Date
$Logname =…
![](../../users/profiles/1853037.webp)
Metal Mike
- 89
- 4
- 12
0
votes
1 answer
Linux Terminal PS1
I am not sure if this is possible but I couldn't find the answer anywhere else or even people who have tried it but my current PS1 is this:
export PS1="\[\e[00;32m\]??\[\e[0m\]\[\e[00;37m\]\n\[\e[0m\]\[\e[01;31m\]\d\[\e[0m\]\[\e[00;37m\] \[\e[0m …
![](../../users/profiles/3845041.webp)
Cuffuffles
- 15
- 2