Tag Info

Hot answers tagged

7

With zsh, use glob qualifiers: mv home*(.) dst moves only regular files. While mv home*(^/) dst moves files of any type except directories. mv home*(^-/) dst would also exclude symlinks to directories.


7

The purpose of ${1+"$@"} for portability. POSIX defined $@ would expand to nothing if there're no positional arguments. But original Bourne shell (or /bin/sh in Solaris 10 and before) would expand it to "". Using ${1+"$@"} is a work around for this, since when "$@" only expanded if $1 was set. Unfortunately, this construct doesn't work in zsh 3.x and pre ...


3

From the bash documentation: Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard. Backslash escape sequences, if present, are decoded as follows: \a alert (bell) (...) \nnn the eight-bit character whose value is the octal ...


3

(posting as community wiki instead, thanks to the contributions in the comments) It is mentioned in the book From Bash to Z Shell (Chapter 8, Page 186, "Generating Numbers with Braces") that this syntax is borrowed from Perl. In addition, it is also suggested that Pascal had the .. range notation dating back as far back as 1970 (emphasis mine) ("The ...


3

You can use find. The following should work. find . -name home\* -type f -maxdepth 1 -exec mv {} /home/homeLife/. \;


2

This seems to be caused by a syntax error somewhere in your dotfiles. Common places to look: .zshrc (or .bashrc, .bash_profile, etc.), and of course .tmux.conf. In my case I forgot to put quotes like so: DISABLE_UPDATE_PROMPT=true should have been DISABLE_UPDATE_PROMPT='true'


2

You're close already. To move your files home1, home2, home3 use the globbing pattern home?. mv home? /home/homeLife/ The ? denotes any single character, while the * denotes any amount of characters (including none).


2

For zsh there are three widgets, which can bound to that effect: push-input, push-line and push-line-or-edit (see man 1 zshzle for more information). On the top-level prompt (PS1) they behave the same: The current buffer is pushed onto the buffer stack and then cleared. On the next promp (or when calling the widget get-line) the buffer will be popped of the ...


1

Why not just use a second shell to check for details? I use screen for that, or just switch to a second desktop where I (usually) also have an open shell. This way, I only spend one extra shortcut to switch to the backup shell and one more to switch back. Of course, this technique won't work in the last case you describe, because my second shell won't have ...


1

Portably you can prune your glob match list: set --; cd /home for f in ./home* do [ ! -L "$f" ] && [ -f "$f" ] && set "$@" "$f" done [ "$#" -eq 0 ] || mv "$@" ./homeLife


1

You can use bash extended globs: shopt -s extglob ## activate extglogs if not yet done mv home!(*Life) homeLife/ ## !(p1|...) = anything except one of the patt


1

Gpg 2.x has almost the same command line options as gpg 1.x, you're unlikely to encounter the very few options that have changed. So declare gpg2 as having the same completions as gpg. In your .zshrc, after the compinit line, add compdef gpg2=gpg If you have no compinit line (it may be somewhere deep in the bowels of oh-my-zsh), put this after the ...



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