Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
1 vote
1 answer
1k views

Invoking zmv from bash

I have recently discovered this technique for renaming files using zsh: autoload zmv zmv '(*).JPG' '$1.jpg' which I can also write as: autoload zmv; zmv '(*).JPG' '$1.jpg' This works as advertised ...
Manngo's user avatar
  • 233
5 votes
1 answer
755 views

How to deal with filenames containing a single quote inside a zsh completion function?

I'm using the zsh shell and have the following code inside my .zshrc: fpath=(~/.zsh/completion $fpath) autoload -Uz _vc autoload -Uz compinit compinit The first line add the path ~/.zsh/completion ...
user547381's user avatar
7 votes
1 answer
3k views

Why does `zip` in a for loop work when the file exists, but not when it doesn't?

I have a directory that contains several sub-directories. There is a question about zipping the files that contains an answer that I ever-so-slightly modified for my needs. for i in */; do zip "zips/...
Wayne Werner's user avatar
  • 11.9k
3 votes
1 answer
115 views

zsh fail to keep unquoted `$*` and `$@` equal

All shells tested do the same for the (quoted) pair "$*" and "$@" with this code: c='set a b @ c; IFS=:,@ ; a=$(printf "<%s> " "$*"); b=$(printf "<%s> " "$@"); printf "%-20s and %-20s\n" "...
user avatar
16 votes
3 answers
9k views

Loop over a string in zsh and Bash

I would like to convert this Bash loop: x="one two three" for i in ${x} do echo ${i} done in such a way to work with both Bash and zsh This solution works: x=( one two three ) for i in ${x[@...
antonio's user avatar
  • 1,463
0 votes
2 answers
3k views

Wildcard not working in quotes

The script is supposed to loop over subdirectories and match all the filenames (FLA.*Image.*file.jpg and FLA.*Image.jpg) in subdirectories and process it. It also create output folder inside the ...
Tom's user avatar
  • 1
10 votes
4 answers
4k views

Why does cut fail with bash and not zsh?

I create a file with tab-delimited fields. echo foo$'\t'bar$'\t'baz$'\n'foo$'\t'bar$'\t'baz > input I have the following script named zsh.sh #!/usr/bin/env zsh while read line; do <<<$...
Sparhawk's user avatar
  • 20.1k
2 votes
1 answer
375 views

Why is a daily .zshrc reload required using an alias containing $(date -u +%Y%m%d)? [closed]

Each morning I run the following command that tails a log file created daily: ssh -t [email protected] tail -f development/abc/$(date -u +%Y%m%d).log This works just fine and each morning the log ...
little_bobby_tables's user avatar
18 votes
1 answer
5k views

Why does this ffmpeg command work in bash and not zsh?

Today I got home from work (run bash on an Ubuntu box) and tried to run some code on my local arch box with my beloved zsh and the commands were failing? The command is below with the personal info ...
John Allard's user avatar
  • 1,378
3 votes
1 answer
973 views

On passing arguments to programs through array variables

NB: though the question below features rsync, it is not a question about rsync; it is a question about zsh arrays. If I initialize the variable EXCLUDES like this EXCLUDES=( --exclude=/foo --exclude=...
kjo's user avatar
  • 15.7k
4 votes
1 answer
3k views

How to declare some aliases dynamically in zsh?

I would like to declare a few shortcut commands to switch between my various coding projects, so I have come up with the following script. projects=$(ls -d ~/Workspace/*/) prefix="/Users/myuser/...
le-doude's user avatar
  • 143
8 votes
2 answers
3k views

Running commands stored in shell variables

The following works in my shell (zsh): > FOO='ls' > $FOO file1 file2 but the following doesn't: > FOO='emacs -nw' > $FOO zsh: command not found: emacs -nw even though invoking emacs -...
Amelio Vazquez-Reina's user avatar
4 votes
1 answer
1k views

Problem with passing parameters containing spaces and wild card characters

I have a problem passing parameters if the parameters may contain wildcards and/or spaces, if those parameters are optional. Since this sounds pretty abstract, let's have a small example: The ...
user1934428's user avatar
0 votes
0 answers
369 views

Zsh - Modify File Completion w/ Quotes

I've been using Zsh recently, and when I complete a file name within quotes, the completion adds a space after the completed file name. Interestingly, this does not occur when I complete directory ...
user avatar
2 votes
1 answer
456 views

Expansion in zsh prompt

I'm struggling with zsh prompt, trying to convert my bash prompt to zsh hooks. This code should display the current kerberos ticket and update accordingly, but colors don't work, neither does the ...
Šimon Tóth's user avatar
  • 8,308

15 30 50 per page