Skip to main content

All Questions

Tagged with
0 votes
2 answers
97 views

How to redirect output from a program that waits for input

Following this post I created my own version of the script, with the difference that user and password are forwarded from the environment variables: #!/bin/zsh pamtester login $user authenticate <&...
Namal's user avatar
  • 101
0 votes
2 answers
85 views

How to analyse a number of different datasets with a script and save the output for each dataset in a different new directory?

I am interested in analysing 50 different datasets with a script and saving the output of each of the 50 analyses in 50 different corresponding directories. To avoid doing this manually, how could ...
Carlos Fernandes's user avatar
0 votes
0 answers
35 views

SSH Agent Scope Issue with i3 and Detached Process

I have an issue with scope of ssh-initialization. I have following script for ssh-init.sh: #!/bin/zsh check-ssh-agent() { [ -S "$SSH_AUTH_SOCK" ] && { ssh-add -l >& /dev/...
Eugene Shtoka's user avatar
3 votes
2 answers
445 views

"history" command ordered by most common

Can I get the output of history sorted in order of most-used? I know how to do it in a programming language, but not from the shell. In my case I'm on macOS with zsh. I know I could use uniq and sort ...
hippietrail's user avatar
0 votes
4 answers
556 views

To check whether first or last character of a string is x

I am trying to check whether the first or the last character of a string is x using zsh, and I get an error message instead: ./test.sh:2: bad substitution What is the problem here? string="2x3&...
jsx97's user avatar
  • 1,347
0 votes
1 answer
110 views

How to make '.zshrc' to search for sourced files in the specific folder and not in the folder from which the terminal has been opened

macOS 14.5, Zsh 5.9. ls -A -- ~/: .zshrc system-wide-clipboard.zsh cat -- ~/.zshrc: autoload -Uz zmv alias zcp='zmv -C' alias zln='zmv -L' . ./system-wide-clipboard.zsh If I open the Terminal ...
jsx97's user avatar
  • 1,347
-1 votes
2 answers
90 views

In bash/zsh, how to compare the metadata in two directories including . and excluding .. and the contents inside subdirectories?

Let's say that in a script, you have a directory $1 and its copy $2 and you'd like to compare the metadata (names, permissions, sizes, full modification dates, …) of the files and directories inside ...
AlMa1r's user avatar
  • 260
2 votes
1 answer
135 views

incrementing file names in zsh

I am trying to write a script in zsh (Linux Mint 21.3 "Virginia") to move (or copy) a file from $source to $target with confusing results. I'm using yad file dialogs to select the files and ...
Terry 's user avatar
  • 43
0 votes
1 answer
88 views

Salesforce dataloader #!/bin/bash script errors mentions .zshrc

I'm trying to run a certain application (Salesforce dataloader v61) on MacOS. The entry point is a bash script: #!/bin/bash DL_INSTALL_ROOT="$(dirname "$(readlink -f "$0")")&...
Al Cher's user avatar
  • 101
0 votes
1 answer
655 views

crontab /bin/zsh: can't open input file: test.sh

I am trying to create a crontab to run a script: * * * * * cd /Users/test3/Desktop/Scripts/backup/ && /bin/zsh test.sh > /tmp/cron-output.log 2>&1 where test.sh is in /Users/test3/...
Mihail's user avatar
  • 41
0 votes
1 answer
60 views

find with execdir, pipe redirection evaluated too early (quote issue?)

I use multiple GitHub accounts at work, so I need to modify the remote url to add my work account. I have figured out the recursive find -execdir, and how to get/sed/set the remote url, but I cannot ...
Robert Altman's user avatar
4 votes
2 answers
905 views

Combine two files as part of a command line parameter

I am trying to use csvgrep (part of csvkit) to extract rows matching one of two files. Unfortunately, there is no command line option that allows two matching files (like grep does). Only, csvgrep -f ...
Robert Altman's user avatar
1 vote
1 answer
504 views

In zsh, Home, End, and Del behave differently inside a script than they do outside

I learned after much frustration that having $EDITOR initially set to vim doesn't affect the main shell but does affect scripts and nothing seems to undo this initial state. Unsetting the env var, ...
Walf's user avatar
  • 1,538
0 votes
0 answers
46 views

How do I execute a command but only add a *modified* version of it to the history?

I'm trying to create an analog of the command history, but for the output of the commands, so that I can do e.g. locate filename (which might display several files) and then vim %2 (or whatever) to ...
colinh's user avatar
  • 47
5 votes
2 answers
308 views

Zsh: Is it possible to use the value of a variable as a substitution pattern?

Is it possible to do something like the following? g=$f:s/$in/$out/; or g=$g:s/$in[$i]/$out[$i]/; I've tried random character combinations like ${~in} and g=$g:ps/ but, as you can see, I'm not a zsh ...
colinh's user avatar
  • 47

15 30 50 per page
1
2 3 4 5
21