Questions tagged [prompt]
23 questions
11
votes
3 answers
Bash: how to know if the last command's output ends with a newline or not?
Most of the time the output of a command ends with the newline character. But sometimes it does not, so the next shell prompt is printed in the same line together with the output.
Example:
root@hostname [~] # echo -n hello
helloroot@hostname [~]…
![](../../users/profiles/4831.webp)
GetFree
- 1,460
- 7
- 23
- 37
8
votes
1 answer
Bash custom prompt breaking wrapping of long command lines
I have a custom bash prompt that colours my username, hostname and current working directory. The colours display correctly, however when I type a command line that needs to wrap, the terminal does not start a new line, and writes over the beginning…
![](../../users/profiles/388.webp)
Murali Suriar
- 10,166
- 8
- 40
- 62
7
votes
3 answers
Getting more helpful tab completion prompts in bash?
Let's say I have a directory with a few files in it like this:
$ ls
file1 file2 file3
And I want to do some tab completion in bash:
$ cat file
file1 file2 file3
I remember seeing someone doing tab completion and the shell bolded the…
![](../../users/profiles/8950.webp)
Amandasaurus
- 30,211
- 62
- 184
- 246
5
votes
4 answers
Prompt customization: how to detect when there is no tty
I have a customized prompt with colors (using tput) and every time I start a non-interactive session in the server I get a bunch of errors.
For instance if I start a non-interactive session like this:
ssh root@hostname6 "echo 'hello' ; echo…
![](../../users/profiles/4831.webp)
GetFree
- 1,460
- 7
- 23
- 37
4
votes
9 answers
Is there a way to delay a forced reboot?
I realize this is more appropriate for our company's admin group to field. However, pretend they are unresponsive just for the sake of discussion =)
If my system is prompting me to reboot now or in a set time (say in 15 mins) is there a way to…
jduff
3
votes
1 answer
Trouble using powershell output as a variable in batch file
I can manually run this command from a Windows Command Prompt:
powershell (new-timespan -start 01/01/2000 -end (get-date)).days % 14
And it returns a number from 0 to 13. I want to use this result in a batch file, but this line gives an error…
![](../../users/profiles/366488.webp)
pigeonpigeon
- 33
- 1
- 3
3
votes
5 answers
Who decided the default shell prompts in Linux?
There are a couple of defaults in the standard Linux shell, bash, that I think need some history brought out. This question is about the prompt.
The default prompt in bash in many Linux distros is [\u@\h \W]\$
For those who can't parse that, it…
![](../../users/profiles/1909.webp)
staticsan
- 1,529
- 1
- 11
- 14
2
votes
1 answer
PS variable for expansion of word designators
Is there an undocumented PS variable like PS2 that bash would show when it replaces a word designator into its actual value? I think it would help clarify where the command ends and where the execution begins.
Example: I run an ls and a cat. cat…
![](../../users/profiles/68477.webp)
Juanma
- 132
- 8
2
votes
1 answer
How to display user@hostname in SSHD password prompt
When I SSH to a server, the prompt sometimes displays my user and the hostname of the server:
xavier@local:~$ ssh server1
xavier@server1's password:
Sometimes all I get is Password:
xavier@local:~$ ssh server2
Password:
Which is less convenient…
![](../../users/profiles/129835.webp)
Calimo
- 400
- 1
- 4
- 15
2
votes
4 answers
How can I copy sanely (not using "Mark") from the Windows command prompt
Given a very long single command at the command line in Windows, I'd like to simply copy that command into clipboard.
I am just looking for the ubiquitous Shift-End , Ctrl-C type functionality almost all editors have.
I DON'T want to use Mark (yes,…
![](../../users/profiles/11326.webp)
Kevin Radcliffe
- 135
- 6
2
votes
4 answers
How to lock user in a shell script program?
Let's say I have a Linux OS without desktop environment. After the PC finish boot up, it will directly show the shell terminal to the user.
I plan to write a shell script program and make it automatically start everytime after the PC finish boot up,…
kwc1
2
votes
3 answers
What's wrong with this bash prompt?
I use the following entry in ~/.bashrc file to colorize the prompt and display current branch of git repository:
PS1='\[\e[1;32m\]\[\u@\h\]\[\e[m\] \[\w\]\[\e[1;1m\]\[$(__git_ps1 " (%s)")\] \[\e[1;1m\]\[$\] \[\e[m\]'
This works almost fine, except…
![](../../users/profiles/36982.webp)
takeshin
- 1,431
- 3
- 19
- 28
2
votes
4 answers
a unix single-line editor/prompt?
I've got a bash script that would be nicer if when I prompt the user, rather than just asking for input, if it provided a line that the user could edit (but a full text editor would be overkill, it's only one line)
What tool provides this?
dialog's…
![](../../users/profiles/2511.webp)
jes5199
- 367
- 1
- 4
- 8
1
vote
3 answers
Ansible - Is it possible to skip the execution of a role?
Here is my main playbook, which launch the roles listed below
---
- hosts: slaves
roles:
- ntp
- nmap
- tcpdump
- unattended-upgrades
- traceroute
- apache
- mysql
I would like to let the user decide if…
![](../../users/profiles/512957.webp)
Osh
- 11
- 1
- 2
1
vote
1 answer
Change login prompt on Debian server
I need to change a telnet login prompt of Debian 4.0 server. Currently it is of form:
hostname login:
I need to have just:
login:
Apparently chnages to /etc/issue.net only influence what is displayed before "login prompt" not the actual…
![](../../users/profiles/61351.webp)
JasonPa112
- 11
- 2