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
0
votes
1 answer

Reading user's PS1 from Swift command-line tool

Is it possible to extract the user's PS1 from the environment in a Swift script, so that I can replicate their prompt? I left a note for myself a few years ago saying that it "disappears from the environment in the context of the script", but I…
Sam
  • 2,350
  • 1
  • 11
  • 22
0
votes
0 answers

How do you make the terminal $PS1 indent when wrapping to a second line?

I'm trying to make my PS1 more readable and one issue I'm currently having is that my file prompts are too long. I don't want to shorten them however, since that would mean loss of exactitude. My solution so far is to simply send the prompt after…
0
votes
0 answers

Add new line before prompt when Python Virtual Environment is active

Currently, my bash prompt prints a new line after the output of the previous command via a '\n' in my PS1 value. Here is a look at my ~/.bash_profile that gets loaded when I enter the shell: function nonzero_return() { local RETVAL=$? [[…
Net-worker
  • 23
  • 6
0
votes
0 answers

This (do-While) loop doesn't want to stop despite meeting the condition - CS50-ps1

What am I doing wrong? it doesn't want to stop. I add printf to many spots to track all the results and they all meet the condition i set for the do-while loop -CS50 #include #include "cs50.h" int main(void) { long long i = 0 ; // we…
0
votes
1 answer

Bash throwing error continously which cannot be canceled with CTRL + C

I was playing with PS1 variable to decorate my terminal but suddenly this happened. It is continously throwing bash: unexpected EOF while looking for matching ')'. I tried CTRL + C and CTRL + D but nothing worked. This code is from ~/.bahsrc file…
Sunlight
  • 165
  • 1
  • 11
0
votes
1 answer

Custom PowerShell Label script

Asking for a bit of help with my script. I would like to get a list saved to a thumb drive with the computer name and the WAN address. I know I can add a custom label with the computer name but would get the default name. I already set the computer…
0
votes
1 answer

Remote access to network share per wmic/ps1 : Access is denied

I want to call (execute) a cmd or ps1 script remotely from one Windows 2016 Server 2016 on another. The problem is that script access to a \\network-share is denied. Reproduce: (1) a batch or ps1 script with specific Domain-User to \\network-share…
So Wieso
  • 1
  • 2
0
votes
1 answer

~/.bashrc change PS1 with color converts newline into carriage return first newline

I changed my prompt as: c=$(basename $CONDA_DEFAULT_ENV) export PS1='[\h] -\e[0;36m$c\e[0;37m (\W) \e[0;52m' In ~/.bashrc. The first newline is actually carriage return but from the second newline these are actually newlines. What I refer…
aerijman
  • 2,522
  • 1
  • 22
  • 32
0
votes
1 answer

Full file path on Bash prompt

Currently my bash prompt looks like this [user_name@server]$ when I cd into a path /dir1/dir2/dir3 it changes to [user_name@server dir3]$ I want it to show the full path as [user_name@server dir1/dir2/dir3]$ How can I do this ?
K_TGTK
  • 765
  • 1
  • 8
  • 24
0
votes
1 answer

Powershell ps1 Get Children Copy command basic

I'm not a coder. I have a Powershell script .ps1 that goes into all subfolders of "db" and deletes the files I want to delete in all of them. It works for what I need. The following code: Get-ChildItem "C:\Program Files…
0
votes
3 answers

BASHRC PS1 show datetime but plus 3 hours

Every of us set own convenience working with Linux shell, for example I use /root/.bashrc PS1='[\h:\w] \D{%F %T}\n\$ ' to show servername + current server datetime + newline for command - so it looks like [servername217:~] 2022-02-06…
Serge
  • 679
  • 1
  • 9
  • 23
0
votes
1 answer

Prompt Expansion ZSH Remove Hostname if entire PROMPT is too long

Currently, my zshrc looks like this setopt prompt_subst # real time reevaluation of prompt zmodload zsh/mathfunc # int function function widthHelper() { echo $(( int(${COLUMNS:-80}) * ${1}/100)) } # calc $1% of prompt outWidth='$(widthHelper…
0
votes
2 answers

Open PowerPoint and then SaveAs

I am not programmer and I need help. I would like to script my daily task. Open PowerPoint (.pptx format) - DONE Press 'A' button to update numbers from Excel - DONE Save PowerPoint (.pptx format) - Do not know how to do it And then save PowerPoint…
0
votes
1 answer

Trying to set a prompt to display a specific portion of PWD in ZSH

I am currently using this in ZSH export PS1='${USER}:${PWD}: ' I could use this: export PS1='${USER}:${PWD##*/} \$ ' But I want to see a folder further up in the folder hierarchy, so I would like to use something like this, export PS1='${USER}:${PWD…
0
votes
1 answer

How to reset a variable value after running a certain command in bash

i wanted to implement a cool feature for my PS1 prompt. I added \# string to show the command number of that command. My goal is that if a certain command is ran, the command number from \# to be set back to 1. I have some ideas but i don't know how…