3

When you call your script like ./myScript.sh myzip test* you give the script the arguments myzip, test1 and test2. The last two arguments are expanded from the test* pattern by the shell before the script is actually invoked. Note that test2 will be available in $3, but your script never uses $3. You can solve this in two ways: Pick off the archive name ...


1

AWK is part of POSIX, so this should be OK: openssl version | awk '$2 ~ /(^0\.)|(^1\.(0\.|1\.0))/ { exit 1 }' Instead of looking for versions greater than or equal to 1.1.1, this looks for versions less than 1.1.1: versions starting with “0.”, “1.0”, or “1.1.0”.


1

Here's one way to do it, use find to list files in each directory, use basename and sort to order them. Then feed each list to comm and only print out the files present in the first directory but not the second. Once the list looks the way you expect it to, you can pipe that to rm. comm -2 -3 <(find "$directory1" -maxdepth 1 -type f | xargs -n1 -d\\n ...


1

I'm not really following this coproc thing. In your case read -p seems just right. And you may want to use a separate (non-default) history file. Warning: the script creates/uses $HOME/.custom_history to save its history. After you test the solution, remove the file by hand. #!/bin/bash # History management hfile="$HOME/.custom_history" HISTCONTROL=...


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