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
-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
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
2 votes
3 answers
393 views

How to compare two directories recursively, and for each pair of files with the same name, location, and contents, say which file is older?

In a Linux shell, how to compare two directories recursively, and for each pair of files (including symlinks and directories) with the same location (including the name) in the two directories and the ...
AlMa1r's user avatar
  • 260
1 vote
3 answers
525 views

Build find command from arguments

I often need to find a file, but I'm not sure what the name is, something like this: $ find -iname '*foo*' -o -iname '*bar*' -o -iname '*blah*' This is a little tedious. I'd like to create an alias ...
Big McLargeHuge's user avatar
1 vote
2 answers
119 views

Start interactive function definition from shell-script

Using zsh or bash, I want to run a script that may prompt the user for multiple commands and store them as a function, however I'm finding that eval "function $FNCNAME() {" or echo "...
Joakim Hagen's user avatar
1 vote
2 answers
221 views

identify content inside base64 encoded content and replace the whole line

I have a script that outputs some information on my shell, like this: field1: value1 field2: value2 ... fieldn: valuen one such field/value can be: CmdLine: C:\Windows\System32\WindowsPowershell\...
João Ciocca's user avatar
4 votes
2 answers
628 views

How to get both the number of bytes and the sha1sum with single pass?

I want to get both the number of bytes and the sha1sum of a command's output. In principle, one can always do something like: BYTES="$( somecommand | wc -c )" DIGEST="$( somecommand | ...
kjo's user avatar
  • 16.2k
0 votes
0 answers
27 views

Bash equivalent of zsh alias at end of command (for pipes) [duplicate]

In zsh, I can set an alias at the end of a command, e.g. making G pipe through grep or L pipe through less. Can I do something similar in bash? E.g. ls G key would expand to ls | grep key or ls L ...
SRobertJames's user avatar
4 votes
2 answers
220 views

How to make the (N) patterns of the zsh eatable by bash?

I am trying to develop a script which runs (and, ideally, does the same :-) ) in zsh and Bash. Problem is, that at a point, the zsh-specific part contains a pattern ending with (N). So: this_pattern*(...
peterh's user avatar
  • 10.3k
2 votes
1 answer
465 views

if var='value' then in Zsh: Is it really a valid syntax without semicolon?

The following code works on Zsh 5.8 that I tried, despite the missing semicolon. But is it really a valid Zsh syntax? #!/bin/zsh if var='value' then echo 'then' fi Without an assignation that ...
Olivier Pirson's user avatar
-1 votes
1 answer
282 views

Can a bash script add to the context of zsh?

I have recently migrated from bash to zsh. I used to use the following token_refresh.sh script to ssh-add my private key to the session: #!/usr/bin/env bash echo "configuring ssh access.." ...
StuperUser's user avatar
0 votes
0 answers
49 views

Compress list of files as their shortest exclusive glob

How can I convert a list of files to the minimum-length glob that expands to those files and no others? E.g. in a directory root ├── one └── two Then the list root/one:root/two can be converted to ...
user avatar

15 30 50 per page
1
2 3 4 5
8