Questions tagged [ps1]

DO NOT USE this tag for questions about PowerShell scripts, use [powershell] instead. Questions about the BASH shell's PS1 (Prompt String 1) input prompt facility.

DO NOT USE this tag for questions about PowerShell scripts, use [powershell] instead.

Questions about the BASH shell's PS1 (Prompt String 1) input prompt facility.

222 questions
2
votes
1 answer

How can I make this script reflect the branch status on PS1?

First of all, I know similar questions have been answered, some of them have even been marked as duplicate. I have read their answers, and while they've given me some insight regarding my problem, I still can't figure out how to fix my PS1. I've…
Luca Bezerra
  • 1,160
  • 1
  • 12
  • 23
2
votes
0 answers

Bash $PS1 with unicode characters provoking typing overlap on a debian 8 Jessie Xen virtual machine

I have a custom bash configuration that I install on many different machines, and this includes a custom $PS1, which is generated by a script, and ends up like this : \[\e[0;33m\][\!] $(if [[ $? == 0 ]]; then echo "\[\e[0;32m\]✓"; else echo…
toadjaune
  • 801
  • 1
  • 6
  • 11
2
votes
1 answer

Mac OSX | Bash .bash_profile not updating PS1

I have a small script named .bash_prompt which is called by source ~/.bash_prompt in ~/.bash_profile. The script sets my PS1 to display some useful information about the current git repo. Unfortunately the git-part is only being executed when…
strnmn
  • 555
  • 1
  • 6
  • 30
2
votes
1 answer

bash ps1 only executes a script once on new terminal windows

I have a very simple ps1 script in my .bashrc file, this excutes a random script generator called blah. export PS1="\[$(tput bold)\]\[$(tput setaf 1)\]\\$ \[$(tput sgr0)\] $PWD :: **$(. blah)** ::" the blah script simply should export a random…
ChrisJAllen
  • 93
  • 1
  • 7
2
votes
1 answer

Long lines overlap in Bash PS1 prompt

I have configured a PS1 bash prompt. My ~/.bashrc file: if [[ $EUID -ne 0 ]]; then PS1='\n\e[0;33m☛ \W\e[0m \n\e[1;35m⤷\e[0m ' fi The problem is that the new line overlaps the previous one. Any idea how to fix this?
Dmitry
  • 281
  • 6
  • 13
2
votes
2 answers

How can one modify PS1 to display time in right most corner?

Currently it is displayed as follows export PS1='${white}[\t] ${blue}\W:${red}$(__git_ps1)${white} \$ ' I'd like to experiment with the same set up, but time displayed in the right most corner. How can i modify my PS1 export for this to happen…
James Raitsev
  • 92,517
  • 154
  • 335
  • 470
2
votes
1 answer

on Ubuntu colored multiline PS1 in bash works wrong with arrow up history

I have next line in .bashrc: PS1="\e[0;32m[ \w ]\n#\e[m " to set very simple welcome line of green color. On Ubuntu using arrow up/down to load previous commands puts extra symbols to the command line: [ /tmp ] # echo "hello there" hello there […
Sergey Grinev
  • 34,078
  • 10
  • 128
  • 141
1
vote
1 answer

Powershell script error when reading JSON file

Im running this piece of code in powershell $url = "https://someURL/file.json" $json = (New-Object System.Net.WebClient).DownloadString($url) $data = $json | ConvertFrom-Json $data | ConvertTo-Json -depth 100 | Out-File…
Jose A.
  • 483
  • 2
  • 7
  • 15
1
vote
1 answer

Detect empty variable in Powershell parameter list or avoid using next string input

I'm trying to read out parameters out of a ps1-file with a Powershell script. (Run with powershell inputfile.ps1 which is calling evaluation.ps1) The input file looks like this: $a=5 $b="" $c= $d=555 Unfortunately it's seems impossible to detect…
Di0nys0s
  • 11
  • 2
1
vote
1 answer

Take a screenshot of each screen separately

I'm trying take a screenshot of each of my screens. Unfortunately, after searching for hours, I've found nothing. Here is my actual PowerShell script content : Add-Type -AssemblyName System.Windows.Forms,System.Drawing $screens =…
Dapkz
  • 13
  • 4
1
vote
2 answers

PowerShell String Replace function with variable value

can we mention the variable in - replace function example: $value="V2" $prop="Groovy=V3" $prop -replace "(?Groovy)=(?[vV]\d)" , "${conf}=${value}"
try.aaam
  • 23
  • 1
  • 7
1
vote
1 answer

Powershell: remove value from property by its value

There is a JSON like: { a: { a1 : { a11:{}; a12:{}; a13:{};}; a2 : {some other values}; } b: { b1: {another values} } } so then I converted it using powershell with command and put it into a variable…
Kate
  • 33
  • 4
1
vote
0 answers

How to get file name which extension is .txt at given path in ps1

I want to get one by on file name which extension is .txt at any given location in ps1. for example my file location is C:\ProjFile and here I have multiple .txt file and I want to get one by one file name
1
vote
1 answer

Which command/function for same output of "\w"

In Bash PS1 prompt, \w refers to the current working directory. Is there any equivalent using a command (best if it supports DIRTRIM env variable too). I thought of the pwd command, but if cwd is /home/foo/bar, the value of "\w" should be ~/bar but…
sudoer
  • 154
  • 7
1
vote
2 answers

Bash: How to set changing variable in PS1 and preserve PS1 codes like \w

I'd like the include a dynamic variable in my PS1 prompt, let's say the 5th folder in the path. I'd also like to include some other PS1 codes (maybe color, username or current directory). I have a script to get the 5th folder and echo it with one…
Rob
  • 13
  • 1
  • 1
  • 2