Tag Info

Hot answers tagged

9

This is what Bash while loops do: while /path/to/application.app do : done It will run the application, and if it terminates successfully run the body of the loop. : is the shell's no-op command (the loop has to have a body, so that's what we put there); after that it goes back to the top and runs the program again. If it fails, the loop stops running ...


8

STDOUT and STDERR don't have colors. What has color is your terminal (emulator); it has one foreground (and one background color) set at a time. It should also be noted that STDOUT and STDERR are not singular -- they're per process output streams. There is no global STDOUT that applies to all programs. These streams are routed to your terminal, but they ...


7

With zsh on terminals that support 16 colors or more à la xterm: preexec() printf '\e[90m' # set foreground color to grey before running # the command precmd() printf '\e[m' # reset the foreground color before issuing the # next prompt. Note that commands may change the terminal's foreground color ...


7

The addition of keys to the agent is transient. They last only so long as the agent is running. If you kill it or restart your computer they're lost until you re-add them again. From the ssh-agent man page: excerpt #1 ssh-agent is a program to hold private keys used for public key authentication (RSA, DSA, ECDSA). The idea is that ssh-agent is started ...


5

The issue is indeed that the Finder's way of modifying permissions doesn't only affect the indicated bits as one might think. For some reason it zeroes out the first octal of the file's mode and it leaves the executable bits untouched. So, some vital programs get their setuid/setgid and sticky bits stripped off which makes them either useless or behave ...


3

remap control : bind -x '"\C-l": clear'


2

The brace expansion you're asking about will only expand for files/directories that match on disk to the pattern you use. The other issue you'll run into is diskutil may not be able to handle more than 1 argument at a time. To expand these you'd need to do a while or for loop, and pass the results to diskutil as you iterate through the loop. Example $ for ...


2

Let's start with some "history". /usr/local is typically used to store user programs/data that were not installed with the base operating system. Commonly, when you make programs from source using automake, they will install somewhere under /usr/local. Because the main operating system itself doesn't rely on this directory, permissions are really up to the ...


2

In MacVim, you need to unmap the Edit > Paste menu item in order to override the shortcut, then you can remap Cmd-V (D-v in MacVim parlance) to the appropriate command in each mode. I added this to my ~/.gvimrc and now everything works wonderfully: macmenu Edit.Paste key=<nop> noremap <D-v> "*P cnoremap <D-v> <C-r>* inoremap ...


1

I have extended your script, so that you can run it once on startup and it will do it's job between 9PM and 9AM. #!/bin/bash -· LOGFILE="/tmp/autotest_run_count.txt" trap "echo manual abort; exit 1" 1 2 3 15 RUNS=0 while [ 1 ] ; do· HOUR="$(date +'%H')" if [ $HOUR -ge 21 -a $HOUR -lt 9 ] ; then # run program libreoffice || exit 1 ...


1

Run dtruss to see what system calls a process is making: dtruss -p55761 This will tell you what system call the process with PID 55761 is currently engaged in. If that system call accesses some file descriptor, lsof will tell you what file is open there. lsof -p55761 If the file is a pipe or socket, I don't know how to find what if anything is on the ...


1

xargs does an unfortunate amount of parsing on its input, and depending on what characters occur in filenames (spaces, quotes/apostrophes, backslashes, tabs, etc) it can mangle them in a number of ways. The best way to handle filenames is as a null-delimited list and using xargs -0 (which turns off all of the parsing). If the file list were generated from ...


1

I found a solution in which I needed to replace a space with a backslash and a space on OS X. Here is what I came up with: echo "Hello World" | sed 's/ /\\ /g' | xargs echo With this all the spaces are retained.


1

This seems to be a question with the XY-problem - it's not asking the right thing to get the desired solution: Assume the output is colored, and the empty part of the screen is of different color or filled with a character. Think about how you expect the output to look for these cases: An empty line? Lines filled with only space characters? Lines ...


1

Of course it's not persistent, the ssh-agent is a session service that stores keys temporarily for the user. The main purpose of SSH agent is to remember the cleartext version of a key secured using a passphrase. In other words, the key is stored on the disk encrypted using a passphrase and the owner of the key uses ssh-add or some GUI tool to provide the ...


1

If the output of diskutil list is something like disk0 disk0s1 disk1 disk1s1 (separated by space or newline) then you need something like this: for dev in $(diskutil list); do diskutil info "$dev" done find find ~/ -type f \( -name '*mp3' -or -name '*mp4' \) You must quote the metacharacters which find shall see.



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