Hot answers tagged

14

Not sure there is an answer to this when using a mouse. If you wanted a command-line way to do it, you can just echo the command and pipe that output to clip: echo stuff you wanted copied to the clipboard | clip FYI, clip is available on Windows 2003. I believe it is a built-in.


8

Wrap each of your color variables in escaped square brackets: \[${COL_USR}\] or COL_USR="\[${COL_Y}${COL_BRIGHT}\]" That tells Bash that these are to be considered zero-width. This is exactly as described in the question you linked to. If you do the following command, you'll see that your variable contain similar character sequences to the ...


7

A possible answer would be that [my_name@my_machine /var/www/html/my_site/my_subdir/another_subdir/yet_another_subdir/and_more_subdirs_yet/see_here/another_subdir/etc $] _ would be a very inconvenient for you to work with


6

The "read" built-in can do editing, using the Readline library, if you give it the "-e" flag: read -e foo


5

The answer is simple — it's a relic of times where terminals were 80 characters wide. Look at your own example — username & host occupies already 16 chars. With additional brackets and spaces there's 20 chars already, and we haven't counted the directory name yet. And the directories can have pretty long names, too. Your example path counts 21 chars and ...


5

There's a bash built-in test for TTY. I forget when it was added, 3.0? I believe it's relatively new. I use it in scripts where I need different behavior when it's run from cron or a user runs it directly. if [ -t 0 ]; then echo "I'm a TTY" fi


4

\[ and \] should only be used around parts of the command prompt that do not advance the cursor, despite having actual text. if __git_ps1 produces any visible output then this will desynchronize your command line.


4

I've been experimenting with the following to emulate the feature from zsh in Bash: $ unset PROMPT_SP; for ((i = 1; i <= $COLUMNS + 52; i++ )); do PROMPT_SP+=' '; done $ PS1='\[\e[7m%\e[m\]${PROMPT_SP: -$COLUMNS+1}\015$ ' It issues a reverse video percent sign, followed by a bunch of spaces to make it wrap to the next line, then a carriage return, ...


3

Put the following at the beginning of /etc/bashrc [ -z "$PS1" ] && return


2

I can recommend Console. It copies multiple lines more sanely. FYI: I find the default mouse button options are different from cmd, so you may wish to change them.


2

In Red Hat based distros there is a package bash-completion. This package fills the /etc/bash_completion.d/ directory with specific completion behaviour for several programs. I'm using it under Fedora, Red Hat and CentOS. yum install bash-completion


2

I have a suggestion that worked for me. Use Process Explorer's tool to find which process displays this window: it was "wuactl*" for me. Right-click on it and use "suspend" tool: this's mainly for debugging, but I liked the way it kills nag screens ;))


2

I don't know of directly ported functionality, but there is a way to hack this in bash. Programmable completion allows you to specify what you'd like to see when you hit that tab key dependent on the calling program, allowing (as a popular example) ssh [tab] to show autocomplete options from ~/.ssh/known_hosts. Here are some useful resources: Intro, ...


2

Anonymous has the right answer. The exact process name is SMSCliUI(.exe). Using shutdown /a will only abort a timed shutdown/restart started by the actual shutdown command. SCCM doesn't use that (for instance, shutdown -r -t 120) until the timer ends, at which point the shutdown is already executed and can't be aborted.


2

This is the correct version: COLOR1="\[\e[1;32m\]" COLOR2='\[\e[1;1m\]' COLOR3='\[\e[m\]' GIT_STATUS=$(__git_ps1 " %s") PROMPT_CHAR="$" PROMPT="${COLOR1}\u@\h${COLOR3} \w${COLOR2}${GIT_STATUS} ${COLOR2}${PROMPT_CHAR} ${COLOR3}" PS1="$PROMPT" export PS1


2

Make your autologin user's login shell be rbash, and make the script the only thing they can run. Even if they escape the script, they won't be able to do anything except log out or start the script again.


2

Microsoft's Command Shell Overview gives a detailed description of where/how variables are stored. The punchline is that User vars are stored in HKCU\Environment, and System vars are in HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment.


1

As far as I'm aware, UAC doesn't ever remember answers in this way. I suspect your theory is correct, in that the first use of a feature prompted its installation and, hence, a UAC prompt. Perhaps the CRM took the failure as an indication not to prompt again. As a test, temporarily disable UAC to see if it makes a difference. Otherwise, you might have to ...


1

Not sure where it was set from, but I was able to get rid of it by setting it in System Properties->Advanced->Environment Variables to "c:\". I then could select it from the list and click delete. Afterward it was gone from my command prompt.


1

getty is the program that handles a terminal. If you tell it to run something other than the shell like getty -l my-sandbox-program-that-is-not-as-powerful-as-the-shell you have much greater control over what the user can do.


1

Add a call to your script in /etc/rc.local, which is run after the system services in /etc/init.d/ have all started and right before the login prompt is displayed. The script will be running as root but without a logged in user so you can control exactly what happens at that point. As long as your script doesn't exit the user will be unable to login and ...


1

Anyone working with this issue, here is the example that worked for me: BEFORE: export PS1="\033[0;33m[\u@\h]\033[1m\e[m \w \033[36m[>>]\033[0m\e[m " AFTER: export PS1='\[\033[0;34m\][\u@\h]\[\033[1m\e[m\] \w \[\033[35m\][>>]\[\033[0m\e[m\] ' Notes all the '\\[\\]' around the colors.


1

Try using processmon (www.sysinternals.com) to capture the issue and find out where the access denied is coming from. If you add a filter for the PID of your site's app pool you won't have too many events. Type iisapp from the command prompt to see the app pool to PID mapping. After you get a capture, search for the word 'denied'. It's likely that ...


1

In zsh, you have vared: % foo=wibble % vared foo wibble and the cursor is then at the end of the wibble, you can edit as you like and when you press enter, you've defined the new value of foo.


1

Here is a description of all 3 methods of doing this: http://tldp.org/LDP/abs/html/intandnonint.html


1

The tput commands are evaluated at the time that the assignment to PS1 is made. Since the startup files are processed when an ssh session is started, the assignment is made even though your session is not interactive. You can test for that and only make your assignment when you are actually starting an interactive session. if [[ $- =~ i ]] then # set ...


1

If it's SCCM related, a restart of the SMS Agent Host service will reset the timer.


1

It sounds like your admins are in control, to put it simply. Thus the short answer is no. If you ask IT to change it for you, you will find them less than helpful.... not because they're a grouchy bunch, but because it's difficult to maintain policies for individual user preferences. Don't ask them to change your screensaver timeout either, they hate that ...


1

How about shutdown -a ? Unless you've done something silly like kill lsass.exe, that should work.


1

I'm using tcsh because of a similar feature. Here is my /etc/csh.cshrc file : if ($?tcsh && $?prompt) then bindkey "\e[1~" beginning-of-line # Home bindkey "\e[7~" beginning-of-line # Home rxvt bindkey "\e[2~" overwrite-mode # Ins bindkey "\e[3~" delete-char # Delete bindkey "\e[4~" end-of-line # End bindkey ...



Only top voted, non community-wiki answers of a minimum length are eligible