Transposing args in noscript, including quotes
I'm trying to create a noscript to interact with my docker containers without having to shell in and run commands manually. It's a very simple noscript:
#!/bin/bash
ALLARGS="$@"
docker compose exec api ash -c "cd ../ && alembic ${ALLARGS}"
I tried a few things (
https://redd.it/1iow04v
@r_bash
I'm trying to create a noscript to interact with my docker containers without having to shell in and run commands manually. It's a very simple noscript:
#!/bin/bash
ALLARGS="$@"
docker compose exec api ash -c "cd ../ && alembic ${ALLARGS}"
I tried a few things (
${ALL_ARGS//\"/\\\"}, sed, others), but finally noticed that "$@" simply doesn't contain the double quotes. Is there a way to transpose the args as is?https://redd.it/1iow04v
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Check if number of arguments is one after all the flag
I have a noscript who can take more than one flag.
So what i have test is if
But if the user type .
if aflag = 1 and (after 'list' is empty)
do something
else
error
So my idea is this on pseudo code. But i don't know how to check dynamicly if the $n+1 after list (
https://redd.it/1ip7zyv
@r_bash
I have a noscript who can take more than one flag.
./noscript -a list is the same than ./noscript list all but list can have other parameter than all so what i want is ./noscript -a list somethingHere give a error.So what i have test is if
$3 is empty when -a is given.But if the user type .
/noscript -a -s list this give a error because $3 is no longer empty but the exeption behavior is to work.if aflag = 1 and (after 'list' is empty)
do something
else
error
So my idea is this on pseudo code. But i don't know how to check dynamicly if the $n+1 after list (
$n) is emptyhttps://redd.it/1ip7zyv
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Unexpected curl command behaviour ?
The following command reads the exchange rate information for the EUR/USD currency pair from HTML page and prints it.
page=$(curl -s https://www.widgets.investing.com/live-currency-cross-rates?theme=darkTheme&pairs=1); echo "$page" | pup 'div.pid-1-bid text{}'
But why doesn't the following command work, instead it prints the entire page?
curl -s https://www.widgets.investing.com/live-currency-cross-rates?theme=darkTheme&pairs=1 | pup 'div.pid-1-bid text{}'
https://redd.it/1imsp0s
@r_bash
The following command reads the exchange rate information for the EUR/USD currency pair from HTML page and prints it.
page=$(curl -s https://www.widgets.investing.com/live-currency-cross-rates?theme=darkTheme&pairs=1); echo "$page" | pup 'div.pid-1-bid text{}'
But why doesn't the following command work, instead it prints the entire page?
curl -s https://www.widgets.investing.com/live-currency-cross-rates?theme=darkTheme&pairs=1 | pup 'div.pid-1-bid text{}'
https://redd.it/1imsp0s
@r_bash
WHAT IS BASH DOING?
**UPDATE**
So it looks like FFPMEG is interacting with the shell in some way... so adding this to the FFPMEG line seems to have resolved the issue.
</dev/null >/dev/null 2>&1
I am doing something dumb... I guess? But I can't figure out what in the heck, when using the EVAL statement, previous variables are stripping off a character for every other loop? Sound confusing? I am confused...
I am using FFMPEG and writing a quick little bash wrapper to automatically detect silences and split apart an audio file.
Let me see if I can show what is going on... This is WITHOUT the eval command...
IFS='\r\n'
while read -r line1; do
IFS= read -r line2
echo "Start: $line1"
echo "End: $line2"
echo "Prev: $PREV"
START="${PREV}"
END="${line1}"
echo "/usr/bin/ffmpeg -hidebanner -loglevel error -i ./${INPUT} -ss ${PREV} -to ${line1} output${COUNT}.wav"
COMMAND='/usr/bin/ffmpeg -hidebanner -loglevel error -i '
COMMAND+="./${INPUT} -ss ${START} -to ${END} output${COUNT}.wav"
echo "${COMMAND}"
# eval ${COMMAND}
COUNT=$(( COUNT + 1 ))
PREV=$line2
echo ''
done <<< $SILENCES
This outputs exactly what I would expect...
Start: 6.04
End: 6.30
Prev: 0
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 0 -to 6.04 output0.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 0 -to 6.04 output0.wav
Start: 21.72
End: 21.98
Prev: 6.30
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 6.30 -to 21.72 output1.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 6.30 -to 21.72 output1.wav
Start: 24.18
End: 24.53
Prev: 21.98
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 21.98 -to 24.18 output2.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 21.98 -to 24.18 output2.wav
Start: 43.34
End: 43.58
Prev: 24.53
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 24.53 -to 43.34 output3.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 24.53 -to 43.34 output3.wav
SO then I uncomment the eval command. That is the only change. I have tried with and without " ", using and not using { } to see if I am interpretting the string differently.
`eval ${COMMAND}`
SOOOO.... Here is the output
Start: 6.04
End: 6.30
Prev: 0
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 0 -to 6.04 output0.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 0 -to 6.04 output0.wav
Start: 1.72
End: 21.98
Prev: 6.30
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 6.30 -to 1.72 output1.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 6.30 -to 1.72 output1.wav
-to value smaller than -ss; aborting.
Start: 24.18
End: 24.53
Prev: 21.98
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 21.98 -to 24.18 output2.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 21.98 -to 24.18 output2.wav
Start: 3.34
End: 43.58
Prev: 24.53
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 24.53 -to 3.34 output3.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 24.53 -to 3.34 output3.wav
-to value smaller than -ss; aborting.
SO Every other iteration... the ${PREV} variable has the first digit/character stripped. So for the second iteration:
21.72 -> 1.72
BUT this ONLY happens when I have the EVAL command AFTER the echo commands. So somehow the eval command is affecting that variable, but I can't see how. Thanks!
https://redd.it/1im9sik
@r_bash
**UPDATE**
So it looks like FFPMEG is interacting with the shell in some way... so adding this to the FFPMEG line seems to have resolved the issue.
</dev/null >/dev/null 2>&1
I am doing something dumb... I guess? But I can't figure out what in the heck, when using the EVAL statement, previous variables are stripping off a character for every other loop? Sound confusing? I am confused...
I am using FFMPEG and writing a quick little bash wrapper to automatically detect silences and split apart an audio file.
Let me see if I can show what is going on... This is WITHOUT the eval command...
IFS='\r\n'
while read -r line1; do
IFS= read -r line2
echo "Start: $line1"
echo "End: $line2"
echo "Prev: $PREV"
START="${PREV}"
END="${line1}"
echo "/usr/bin/ffmpeg -hidebanner -loglevel error -i ./${INPUT} -ss ${PREV} -to ${line1} output${COUNT}.wav"
COMMAND='/usr/bin/ffmpeg -hidebanner -loglevel error -i '
COMMAND+="./${INPUT} -ss ${START} -to ${END} output${COUNT}.wav"
echo "${COMMAND}"
# eval ${COMMAND}
COUNT=$(( COUNT + 1 ))
PREV=$line2
echo ''
done <<< $SILENCES
This outputs exactly what I would expect...
Start: 6.04
End: 6.30
Prev: 0
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 0 -to 6.04 output0.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 0 -to 6.04 output0.wav
Start: 21.72
End: 21.98
Prev: 6.30
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 6.30 -to 21.72 output1.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 6.30 -to 21.72 output1.wav
Start: 24.18
End: 24.53
Prev: 21.98
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 21.98 -to 24.18 output2.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 21.98 -to 24.18 output2.wav
Start: 43.34
End: 43.58
Prev: 24.53
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 24.53 -to 43.34 output3.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 24.53 -to 43.34 output3.wav
SO then I uncomment the eval command. That is the only change. I have tried with and without " ", using and not using { } to see if I am interpretting the string differently.
`eval ${COMMAND}`
SOOOO.... Here is the output
Start: 6.04
End: 6.30
Prev: 0
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 0 -to 6.04 output0.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 0 -to 6.04 output0.wav
Start: 1.72
End: 21.98
Prev: 6.30
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 6.30 -to 1.72 output1.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 6.30 -to 1.72 output1.wav
-to value smaller than -ss; aborting.
Start: 24.18
End: 24.53
Prev: 21.98
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 21.98 -to 24.18 output2.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 21.98 -to 24.18 output2.wav
Start: 3.34
End: 43.58
Prev: 24.53
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 24.53 -to 3.34 output3.wav
/usr/bin/ffmpeg -hidebanner -loglevel error -i ./audio.wav -ss 24.53 -to 3.34 output3.wav
-to value smaller than -ss; aborting.
SO Every other iteration... the ${PREV} variable has the first digit/character stripped. So for the second iteration:
21.72 -> 1.72
BUT this ONLY happens when I have the EVAL command AFTER the echo commands. So somehow the eval command is affecting that variable, but I can't see how. Thanks!
https://redd.it/1im9sik
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How can I combine these two awk commands?
This command gives me the latest version of Powershell. I just want the result from the last line. How can I add the END rule to the first awk command?
https://redd.it/1ik223z
@r_bash
git ls-remote -t `https://github.com/PowerShell/PowerShell.git` | awk -e '$2 ~ /v[0-9].[0-9].[0-9]$/ {sub(/refs\/tags\/v/,"");print $2}' | awk 'END {print}'This command gives me the latest version of Powershell. I just want the result from the last line. How can I add the END rule to the first awk command?
https://redd.it/1ik223z
@r_bash
GitHub
GitHub - PowerShell/PowerShell: PowerShell for every system!
PowerShell for every system! Contribute to PowerShell/PowerShell development by creating an account on GitHub.
Does anyone know of an interactive BASH command builder that is built with BASH noscripts?
I'd love to have an interactive shell environment that helps students new to BASH navigates its opacity and easily survey the breadth of options. I would also like it for myself, since one can always learn more.
This is especially useful when BASH is required for a subject like Practical Control Theory with Python but is not the subject of the class. Think of it as a nice gateway drug for BASH.
And while I'm asking for ponies, I think it would be best to make this run natively inside terminal emulators. So writing it as a BASH noscript would be great.
https://redd.it/1iq37l3
@r_bash
I'd love to have an interactive shell environment that helps students new to BASH navigates its opacity and easily survey the breadth of options. I would also like it for myself, since one can always learn more.
This is especially useful when BASH is required for a subject like Practical Control Theory with Python but is not the subject of the class. Think of it as a nice gateway drug for BASH.
And while I'm asking for ponies, I think it would be best to make this run natively inside terminal emulators. So writing it as a BASH noscript would be great.
https://redd.it/1iq37l3
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Could anyone show me how parallel works?
Does anyone have good examples of how 'parallel' can work with bash functions or noscripts? I have several for processing filetypes that I'd like to make happen more quickly
https://redd.it/1iqaw6o
@r_bash
Does anyone have good examples of how 'parallel' can work with bash functions or noscripts? I have several for processing filetypes that I'd like to make happen more quickly
https://redd.it/1iqaw6o
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Help with login noscript
I have created two login noscripts, one of which is working wonderfully. However, the other only works under certain conditions and I need some help making it more circumstance independent. Here's what I mean:
Both noscripts are for starting Google Chrome PWAs and then docking them to my system tray with kdocker. The first one is for Google Messages and the second is for Gmail.
Here is the first noscript:
#!/bin/bash
# Start Messages
/opt/google/chrome/google-chrome --profile-directory=Default --app-id=hpfldicfbfomlpcikngkocigghgafkph &
# Set ID variable
messages=$(xdotool search --sync --name "Messages - Google Messages for web")
# Pin to tray
kdocker -w $messages -i /home/ego/.local/share/icons/hicolor/128x128/apps/chrome-hpfldicfbfomlpcikngkocigghgafkph-Default.png &
# Quit
exit
And here is the second:
#!/bin/bash
# Start Gmail
/opt/google/chrome/google-chrome --profile-directory=Default --app-id=fmgjjmmmlfnkbppncabfkddbjimcfncm &
# Set ID variable
gmail=$(xdotool search --sync --name "Gmail - Inbox - myemail@gmail.com - Gmail")
# Pin to tray
kdocker -w $gmail -i /home/ego/.local/share/icons/hicolor/128x128/apps/chrome-fmgjjmmmlfnkbppncabfkddbjimcfncm-Default.png &
# Quit
exit
The problem with the Gmail noscript is that this string:
https://redd.it/1iq7bko
@r_bash
I have created two login noscripts, one of which is working wonderfully. However, the other only works under certain conditions and I need some help making it more circumstance independent. Here's what I mean:
Both noscripts are for starting Google Chrome PWAs and then docking them to my system tray with kdocker. The first one is for Google Messages and the second is for Gmail.
Here is the first noscript:
#!/bin/bash
# Start Messages
/opt/google/chrome/google-chrome --profile-directory=Default --app-id=hpfldicfbfomlpcikngkocigghgafkph &
# Set ID variable
messages=$(xdotool search --sync --name "Messages - Google Messages for web")
# Pin to tray
kdocker -w $messages -i /home/ego/.local/share/icons/hicolor/128x128/apps/chrome-hpfldicfbfomlpcikngkocigghgafkph-Default.png &
# Quit
exit
And here is the second:
#!/bin/bash
# Start Gmail
/opt/google/chrome/google-chrome --profile-directory=Default --app-id=fmgjjmmmlfnkbppncabfkddbjimcfncm &
# Set ID variable
gmail=$(xdotool search --sync --name "Gmail - Inbox - myemail@gmail.com - Gmail")
# Pin to tray
kdocker -w $gmail -i /home/ego/.local/share/icons/hicolor/128x128/apps/chrome-fmgjjmmmlfnkbppncabfkddbjimcfncm-Default.png &
# Quit
exit
The problem with the Gmail noscript is that this string:
Gmail - Inbox - myemail@gmail.com - Gmail changes based on how many emails I have in my inbox. For example, if I have three emails, it will read: Gmail - Inbox (3) - myemail@gmail.com - Gmail. This causes xdotool to not find it and subsequently causes kdocker to fail to pin it in the system tray unless I specifically have zero unread messages in my inbox, which is obviously not ideal. Can anybody help me figure out a better way to target the windows in both of my noscripts so that they are able to find the correct window in more varying conditions?https://redd.it/1iq7bko
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
printf
There are 3 places you can get info on how to use printf in bash. One is by consulting the bash man page (or help), because bash's builtin printf command is used by default. But you probably also have an installed printf command. For example, at /usr/bin/printf. So you can check
Using all of that, I came up with this printf command that I put in my PS1:
The argument to the format string (the seq) gets the current width of the terminal window, as an integer, and then spits out that many arguments, in the form of number strings. The format string produces a Unicode character and then one of the string arguments converted to zero-width. A zero-width string is literally just "". So the printf is printing the Unicode character and then nothing. But because there are, say, 100 string arguments, it'll repeat this over and over again, that many times.
The reason I came up with this is because, for a while, I was having trouble seeing where one command ran and ended when I was scrolling through my terminal window history. This printf creates a nice visual barrier that's easy to catch even when you're scrolling in the window.
Anyway, I thought it was pretty clever so I wanted to share with you guys.
https://redd.it/1iq782d
@r_bash
There are 3 places you can get info on how to use printf in bash. One is by consulting the bash man page (or help), because bash's builtin printf command is used by default. But you probably also have an installed printf command. For example, at /usr/bin/printf. So you can check
man 1 printf. There's also the printf library, which you can read about in man 3 printf. Even though bash has printf builtin, it depends on the printf library, and so some of the stuff in the two man pages applies to the builtin command as well.Using all of that, I came up with this printf command that I put in my PS1:
printf "\\u2501%.0s" $(seq "$(tput cols)")The argument to the format string (the seq) gets the current width of the terminal window, as an integer, and then spits out that many arguments, in the form of number strings. The format string produces a Unicode character and then one of the string arguments converted to zero-width. A zero-width string is literally just "". So the printf is printing the Unicode character and then nothing. But because there are, say, 100 string arguments, it'll repeat this over and over again, that many times.
The reason I came up with this is because, for a while, I was having trouble seeing where one command ran and ended when I was scrolling through my terminal window history. This printf creates a nice visual barrier that's easy to catch even when you're scrolling in the window.
Anyway, I thought it was pretty clever so I wanted to share with you guys.
https://redd.it/1iq782d
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Here're 22 best free video converter software and online apps that you can use to convert video formats without any cost.
https://www.videoproc.com/media-converter/best-video-converter.htm
https://redd.it/1iqowa9
@r_bash
https://www.videoproc.com/media-converter/best-video-converter.htm
https://redd.it/1iqowa9
@r_bash
Videoproc
9 Best Free Video Converters for PC and Mac (Compared)
Need the best video converter for Windows & Mac? This curated list covers truly free video converters and top-value paid options for all your conversion needs.
Where do you store reusable code snippets?
Hey folks! Curios where do you store your code snippets? If you work in a team how do you manage it?
https://redd.it/1iqwadh
@r_bash
Hey folks! Curios where do you store your code snippets? If you work in a team how do you manage it?
https://redd.it/1iqwadh
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Bash noscript explain
This is a noscript in Openwrt. I know what this noscript does at higher level but can I get explanation of every line.
case $PATH in
(*[!:]:) PATH="$PATH:" ;;
esac
for ELEMENT in $(echo $PATH | tr ":" "\n"); do
PATH=$ELEMENT command -v "$@"
done
https://redd.it/1iqrfzb
@r_bash
This is a noscript in Openwrt. I know what this noscript does at higher level but can I get explanation of every line.
case $PATH in
(*[!:]:) PATH="$PATH:" ;;
esac
for ELEMENT in $(echo $PATH | tr ":" "\n"); do
PATH=$ELEMENT command -v "$@"
done
https://redd.it/1iqrfzb
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Can someone explain the following: mkdir ${1:-aa}
Trying to understand the following:
mkdir ${1:-aa) and it seems to work by changing 1 to another number it works as well.
also
mkdir ${a:-a} creates a directory 1
but
mkdir ${b:-b} creates b
Any help would be great as learning.
https://redd.it/1iso5zj
@r_bash
Trying to understand the following:
mkdir ${1:-aa) and it seems to work by changing 1 to another number it works as well.
also
mkdir ${a:-a} creates a directory 1
but
mkdir ${b:-b} creates b
Any help would be great as learning.
https://redd.it/1iso5zj
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Efficient way to find outliers?
***Sorry if this is the wrong place, I use bash for most of my quick filtering, and use Julia for plotting and the more complex tasks.***
I'm trying to clean up my data to remove obvious erroneous data. As of right now, I'm implementing the following:
awk -F "\"*,\"*" 'NR>1 && $4 >= 2.5 {print $4, $6, $1}' *
And my output would look something like this, often with 100's to 1000's of lines that I look through for both a value and decimal year that I think match with my outlier. lol:
2.6157 WRHS 2004.4162
3.2888 WRHS 2004.4189
2.9593 WRHS 2004.4216
2.5311 WRHS 2004.4682
2.5541 WRHS 2004.5421
2.9214 WRHS 2004.5667
2.8221 WRHS 2004.5695
2.5055 WRHS 2004.5941
2.6548 WRHS 2004.6735
2.8185 WRHS 2004.6817
2.5293 WRHS 2004.6899
2.9378 WRHS 2004.794
2.8769 WRHS 2004.8022
2.7513 WRHS 2004.9008
2.5375 WRHS 2004.9144
2.8129 WRHS 2004.9802
Where I just make sure I'm in the correct directory depending on which component I'm looking through. I adjust the values to some value that I think represents an outlier value, along with the GPS station name and the decimal year that value corresponds to.
[Timeseries Plot](https://imgur.com/a/3p4LIqa)
Right now, I'm trying to find the three outlying peaks in the vertical component. I need to update the noscript to reflect that the lines shown are a 365-day windowed average.
I do have individual timeseries plots too, but, looking through all 423 plots is inefficient and I don't always pick out the correct one.
I guess I'm a little stuck with figuring out a solid tactic to find these outliers. I tried plotting all the station names in various arrangements, but for obvious reasons that didn't work.
Actually, now that I write this out, I could just create separate plots for the average of each station and that would quickly show me which ones are plotting as outliers -- as long as I plot the station name in the noscript...
okay, I'm going to do that. Writing this out helped. If anyone has any other idea though of how I could efficiently do this in bash, I'm always looking for efficient ways to look through my data.
:)
https://redd.it/1isop2r
@r_bash
***Sorry if this is the wrong place, I use bash for most of my quick filtering, and use Julia for plotting and the more complex tasks.***
I'm trying to clean up my data to remove obvious erroneous data. As of right now, I'm implementing the following:
awk -F "\"*,\"*" 'NR>1 && $4 >= 2.5 {print $4, $6, $1}' *
And my output would look something like this, often with 100's to 1000's of lines that I look through for both a value and decimal year that I think match with my outlier. lol:
2.6157 WRHS 2004.4162
3.2888 WRHS 2004.4189
2.9593 WRHS 2004.4216
2.5311 WRHS 2004.4682
2.5541 WRHS 2004.5421
2.9214 WRHS 2004.5667
2.8221 WRHS 2004.5695
2.5055 WRHS 2004.5941
2.6548 WRHS 2004.6735
2.8185 WRHS 2004.6817
2.5293 WRHS 2004.6899
2.9378 WRHS 2004.794
2.8769 WRHS 2004.8022
2.7513 WRHS 2004.9008
2.5375 WRHS 2004.9144
2.8129 WRHS 2004.9802
Where I just make sure I'm in the correct directory depending on which component I'm looking through. I adjust the values to some value that I think represents an outlier value, along with the GPS station name and the decimal year that value corresponds to.
[Timeseries Plot](https://imgur.com/a/3p4LIqa)
Right now, I'm trying to find the three outlying peaks in the vertical component. I need to update the noscript to reflect that the lines shown are a 365-day windowed average.
I do have individual timeseries plots too, but, looking through all 423 plots is inefficient and I don't always pick out the correct one.
I guess I'm a little stuck with figuring out a solid tactic to find these outliers. I tried plotting all the station names in various arrangements, but for obvious reasons that didn't work.
Actually, now that I write this out, I could just create separate plots for the average of each station and that would quickly show me which ones are plotting as outliers -- as long as I plot the station name in the noscript...
okay, I'm going to do that. Writing this out helped. If anyone has any other idea though of how I could efficiently do this in bash, I'm always looking for efficient ways to look through my data.
:)
https://redd.it/1isop2r
@r_bash
Imgur
Discover the magic of the internet at Imgur, a community powered entertainment destination. Lift your spirits with funny jokes, trending memes, entertaining gifs, inspiring stories, viral videos, and so much more from users.
Protect exclamation point when using double quotes and sed
Hi!
The following line
sed "/$PATTERN1/,/$PATTERN2/{/$PATTERN1/n;/$PATTERN2/!d;}" $FILE
deletes everything between the two patterns but not the lines containg them. I want to abstract this to a function. However, even when issuing the command interactively, the above line always result in this error:
Is there a way of protecting the exclamation point inside the sed command line when using double-quotes so it doesn't try to do history expansion?
Thanks!
https://redd.it/1itm6nk
@r_bash
Hi!
The following line
sed "/$PATTERN1/,/$PATTERN2/{/$PATTERN1/n;/$PATTERN2/!d;}" $FILE
deletes everything between the two patterns but not the lines containg them. I want to abstract this to a function. However, even when issuing the command interactively, the above line always result in this error:
bash: !d}: event not foundz. This makes sense because ! is history expansion. If I use the line with single quotes, there's n problem but I cannot expand the value of shell variables, which is what I want. I also tried escaping the exclamation sign, i.e. \!, but I excpetedly get unknown command:'`.Is there a way of protecting the exclamation point inside the sed command line when using double-quotes so it doesn't try to do history expansion?
Thanks!
https://redd.it/1itm6nk
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
🎉 FuzPad 2.0 is now released 🎉 FuzPad is a minimalistic note management solution. Powered by fzf
https://github.com/JianZcar/FuzPad
https://redd.it/1ito7d2
@r_bash
https://github.com/JianZcar/FuzPad
https://redd.it/1ito7d2
@r_bash
GitHub
GitHub - JianZcar/FuzPad at terminaltrove
A minimalistic note management solution. Powered by fzf - GitHub - JianZcar/FuzPad at terminaltrove
Instructions on how to grab multiple downloads using loop
I am downloading many hundreds of military documents on their use of aerosol atmospheric injection for weather control and operational strategies. One example is here:
https://babel.hathitrust.org/cgi/imgsrv/image?id=uc1.d0008795742&attachment=1&tracker=D4&format=image%2Fjpeg&size=ppi%3A300&seq=1
This is just a scanned book which is unclassified. I already have a PDF version of the book taken directly from gpo.gov and govinfo.gov but I want to save this scanned original. This link connects to a JPG scan, and the seq variable is the page number.
I want to use wget or curl or any other useful tool to pass a loop of the URL and grab all of the pages at one time.
Here is the conceptual idea:
FOR %COUNT in (1,1,52) do (
WGET "https://babel.hathitrust.org/cgi/imgsrv/image?id=uc1.d0008795742&attachment=1&tracker=D4&format=image%2Fjpeg&size=ppi%3A300&seq=%COUNT"
)
If you can help with this, it would be much appreciated. Thank you
Linux Mint 21.1 Cinnamon
Bash 5.1.16
https://redd.it/1itm3ss
@r_bash
I am downloading many hundreds of military documents on their use of aerosol atmospheric injection for weather control and operational strategies. One example is here:
https://babel.hathitrust.org/cgi/imgsrv/image?id=uc1.d0008795742&attachment=1&tracker=D4&format=image%2Fjpeg&size=ppi%3A300&seq=1
This is just a scanned book which is unclassified. I already have a PDF version of the book taken directly from gpo.gov and govinfo.gov but I want to save this scanned original. This link connects to a JPG scan, and the seq variable is the page number.
I want to use wget or curl or any other useful tool to pass a loop of the URL and grab all of the pages at one time.
Here is the conceptual idea:
FOR %COUNT in (1,1,52) do (
WGET "https://babel.hathitrust.org/cgi/imgsrv/image?id=uc1.d0008795742&attachment=1&tracker=D4&format=image%2Fjpeg&size=ppi%3A300&seq=%COUNT"
)
If you can help with this, it would be much appreciated. Thank you
Linux Mint 21.1 Cinnamon
Bash 5.1.16
https://redd.it/1itm3ss
@r_bash
can someone explain /bin/bash -c
The following 2 commands yield nothing or limited subset
sudo -u testuser echo $PATH <---I realize there is an option in visudo to preserve
sudo -u testuser env < --- this gives a much smaller/truncated output
Whereas the commands below give a the same output as if I'm logged in as the testuser
sudo -i -u testuser /bin/bash -c 'echo $PATH' <---this gets passed through regardless of option in visudo
sudo -i -u testuer /bin/bash -c 'env'
I have a guess as to what is going on but I am not 100% sure
https://redd.it/1itsp9k
@r_bash
The following 2 commands yield nothing or limited subset
sudo -u testuser echo $PATH <---I realize there is an option in visudo to preserve
sudo -u testuser env < --- this gives a much smaller/truncated output
Whereas the commands below give a the same output as if I'm logged in as the testuser
sudo -i -u testuser /bin/bash -c 'echo $PATH' <---this gets passed through regardless of option in visudo
sudo -i -u testuer /bin/bash -c 'env'
I have a guess as to what is going on but I am not 100% sure
https://redd.it/1itsp9k
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Remove whitespaces from text but only IN words. Is it even possible ?
Hello,
I have a larger textfile in german, that looks like this:
Hello this is an i n t e r e s t i n g text but i dont l i k e whitespaces.
In some random words there is also a whitespace between every character. My only idea is to create an large txt file with all german words in t h i s way and replace them if they happen. Does someone know a more elegant way ?
https://redd.it/1iu6xr4
@r_bash
Hello,
I have a larger textfile in german, that looks like this:
Hello this is an i n t e r e s t i n g text but i dont l i k e whitespaces.
In some random words there is also a whitespace between every character. My only idea is to create an large txt file with all german words in t h i s way and replace them if they happen. Does someone know a more elegant way ?
https://redd.it/1iu6xr4
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How to remove Enter key symbol?
When executing
How can I remove that "Enter key symbol" at the end?
https://redd.it/1iuoq5q
@r_bash
When executing
cat /sys/firmware/devicetree/base/model on my Raspberry Pi in order to get the model of Pi I am working with, the output looks as follows:> cat /sys/firmware/devicetree/base/model
Raspberry Pi 3 Model B Rev 1.2⏎
How can I remove that "Enter key symbol" at the end?
https://redd.it/1iuoq5q
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community