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
Can I Use the Same Ubuntu Installation for Both WSL2 and a Bootable OS on My External SSD?
I’m setting up Ubuntu on my external SSD and I want to achieve a specific workflow:
1. Boot Ubuntu directly from my SSD when I need a full Linux environment.
2. Use the same Ubuntu installation inside Windows as WSL2 (instead of having two separate installations).
3. Keep all my files, user settings, and configurations the same between WSL2 and the bootable OS.
I tried looking into WSL2 VHDX files, but they seem to work as a virtual disk rather than a direct partition mount. Ideally, I’d like to install Ubuntu as a normal OS on my SSD, and then make Windows mount the same filesystem inside WSL2.
Has anyone done this before? Any issues with permissions, GRUB, or performance? Would love to hear your suggestions!
# System Details:
External SSD: 1TB
Planned Ubuntu Partition: 100-150GB (EXT4)
Windows Version: Windows 11
WSL Version: WSL2
Let me know if this setup is possible or if there’s a better way! 🚀
Thanks!
https://redd.it/1iuqqnq
@r_bash
I’m setting up Ubuntu on my external SSD and I want to achieve a specific workflow:
1. Boot Ubuntu directly from my SSD when I need a full Linux environment.
2. Use the same Ubuntu installation inside Windows as WSL2 (instead of having two separate installations).
3. Keep all my files, user settings, and configurations the same between WSL2 and the bootable OS.
I tried looking into WSL2 VHDX files, but they seem to work as a virtual disk rather than a direct partition mount. Ideally, I’d like to install Ubuntu as a normal OS on my SSD, and then make Windows mount the same filesystem inside WSL2.
Has anyone done this before? Any issues with permissions, GRUB, or performance? Would love to hear your suggestions!
# System Details:
External SSD: 1TB
Planned Ubuntu Partition: 100-150GB (EXT4)
Windows Version: Windows 11
WSL Version: WSL2
Let me know if this setup is possible or if there’s a better way! 🚀
Thanks!
https://redd.it/1iuqqnq
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Efficient Execution
Is there a way to load any executable once, then use the pre-loaded binary multiple times to save time and boost efficiency in Linux?
Is there a way to do the same thing, but parallelized?
My use-case is to batch run the exact same thing, same options even, on hundreds to thousands of inputs of varying size and content- and it should be quick. Quick as possible.
https://redd.it/1iurn0j
@r_bash
Is there a way to load any executable once, then use the pre-loaded binary multiple times to save time and boost efficiency in Linux?
Is there a way to do the same thing, but parallelized?
My use-case is to batch run the exact same thing, same options even, on hundreds to thousands of inputs of varying size and content- and it should be quick. Quick as possible.
https://redd.it/1iurn0j
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Name associative array after variable
I need to be able to do something like "Declare -A $var", $var"${key}"="${value}", and echo "$var${key}". What would the correct syntax for this be?
https://redd.it/1ivlhfg
@r_bash
I need to be able to do something like "Declare -A $var", $var"${key}"="${value}", and echo "$var${key}". What would the correct syntax for this be?
https://redd.it/1ivlhfg
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
What is wrong with my command using rsync?
Hi
using rsync from home to media (a pendrive) I get an error 30
rsync: receiver mkstemp "/media/jazei/MSDB/Vim/.plugins.txt.uul3Lm" failed: Read-only file system (30)
even using dirdiff I get same error read only file system...
what should I check?
I tryed chmod 777and sudo chmod... but nothing I am shielded !
this is a micro sd memory ...
see this URL screen shot: https://imgbox.com/9olj7ivT
Thank you and regards!
https://redd.it/1ixzbe1
@r_bash
Hi
using rsync from home to media (a pendrive) I get an error 30
rsync: receiver mkstemp "/media/jazei/MSDB/Vim/.plugins.txt.uul3Lm" failed: Read-only file system (30)
even using dirdiff I get same error read only file system...
what should I check?
I tryed chmod 777and sudo chmod... but nothing I am shielded !
this is a micro sd memory ...
see this URL screen shot: https://imgbox.com/9olj7ivT
Thank you and regards!
https://redd.it/1ixzbe1
@r_bash
Imgbox
imgbox - fast, simple image host
Use imgbox to upload, host and share all your images. It's simple, free and blazing fast!
I configured my bash to simulate bottom padding so my command prompt is never on the last row
https://redd.it/1iya9vk
@r_bash
https://redd.it/1iya9vk
@r_bash
Where to put sourced functions?
What is the recommended place to put sourced functions in Bash? What if I want to share those functions with other users?
`.bashrc` is probably the most obvious place, but that doesn't seem to scale very well. Is there maybe some standardized place where I can put them?
https://redd.it/1iypvm8
@r_bash
What is the recommended place to put sourced functions in Bash? What if I want to share those functions with other users?
`.bashrc` is probably the most obvious place, but that doesn't seem to scale very well. Is there maybe some standardized place where I can put them?
https://redd.it/1iypvm8
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
pgrep shows PID but there's no instance
I'm confused why `pgrep tmux` shows the PID in the noscript even though tmux hasn't been called yet (and I confirmed `pgrep tmux` shows nothing prior to running the noscript):
Script:
#!/usr/bin/bash
if [[ $# -eq 1 ]]; then
selected=$1
else
selected=$(find ~/bin/ ~/work/builds ~/projects -mindepth 1 -maxdepth 1 -type d | fzf)
fi
if [[ -z $selected ]]; then
exit 0
fi
selected_name=$(basename "$selected" | tr . _)
tmux_running=$(pgrep tmux)
echo TMUX=$TMUX
echo tmux_running=$tmux_running
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
tmux new-session -s $selected_name -c $selected
exit 0
fi
if ! tmux has-session -t=$selected_name 2>/dev/null; then
tmux new-session -ds $selected_name -c $selected
fi
tmux switch-client -t $selected_name
My shell:
# same condition as in noscript
$ ~ $ [[ -z $TMUX ]] && [[ -z $tmux_running ]] && echo ok
ok
$ ~ $ tmux kill-server
no server running on /tmp/tmux-1000/default
$ ~ $ pgrep tmux
$ ~ $ tmux-sessionizer
find: ‘/home/enory/work/builds’: No such file or directory
find: ‘/home/enory/projects’: No such file or directory
TMUX=
tmux_running=38971
no current client
Here, there's a PID of `38971` for tmux even though tmux hasn't started yet. As a result, the last command of the noscript runs, resulting in `no current client`.
How is this possible? **What's bizarre is if I run `bash -x tmux-sessionizer`, then the results are expected, i.e. there's no PID yet and the noscript works as intended.**
https://redd.it/1izaz8d
@r_bash
I'm confused why `pgrep tmux` shows the PID in the noscript even though tmux hasn't been called yet (and I confirmed `pgrep tmux` shows nothing prior to running the noscript):
Script:
#!/usr/bin/bash
if [[ $# -eq 1 ]]; then
selected=$1
else
selected=$(find ~/bin/ ~/work/builds ~/projects -mindepth 1 -maxdepth 1 -type d | fzf)
fi
if [[ -z $selected ]]; then
exit 0
fi
selected_name=$(basename "$selected" | tr . _)
tmux_running=$(pgrep tmux)
echo TMUX=$TMUX
echo tmux_running=$tmux_running
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
tmux new-session -s $selected_name -c $selected
exit 0
fi
if ! tmux has-session -t=$selected_name 2>/dev/null; then
tmux new-session -ds $selected_name -c $selected
fi
tmux switch-client -t $selected_name
My shell:
# same condition as in noscript
$ ~ $ [[ -z $TMUX ]] && [[ -z $tmux_running ]] && echo ok
ok
$ ~ $ tmux kill-server
no server running on /tmp/tmux-1000/default
$ ~ $ pgrep tmux
$ ~ $ tmux-sessionizer
find: ‘/home/enory/work/builds’: No such file or directory
find: ‘/home/enory/projects’: No such file or directory
TMUX=
tmux_running=38971
no current client
Here, there's a PID of `38971` for tmux even though tmux hasn't started yet. As a result, the last command of the noscript runs, resulting in `no current client`.
How is this possible? **What's bizarre is if I run `bash -x tmux-sessionizer`, then the results are expected, i.e. there's no PID yet and the noscript works as intended.**
https://redd.it/1izaz8d
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Best way to learn BASH noscripting as a lawyer?
I don’t come from a tech or computer science background—I’m an attorney, and a significant portion of my work revolves around legal documentation. Much of my daily tasks involve repetitive processes, such as OCR (Optical Character Recognition) for scanned documents, formatting files, and managing large volumes of paperwork.
A few days back, I had a monotonous task in front of me: OCRing about 40 PDFs. Under normal circumstances, this would involve opening each document separately or using an online service, which is time-consuming and inefficient. The sheer drudgery of the task led me to wonder if there was an easier way.
That's when I approached ChatGPT for assistance. It recommended writing a Bash noscript to run the task using an ocrmypdf tool. I never wrote a noscript in my life, but I tried it. ChatGPT gave me the noscript, and as soon as I ran it, everything became really simple. Rather than handling every file separately, all I had to do was:
Put all the PDFs in one folder.
Run the noscript.
The noscript automatically produced an output folder and OCR'd all of them simultaneously.
It was an eye-opener experience. I had come to the realization that I could drastically decrease the effort spent manually doing these tasks and have a much more convenient life if I could do some basic Bash noscripting. If I am able to automate a single monotonous task, then likely several others, then hours worth of work can be saved down the road.
Where Should I Start Learning Bash Scripting?
I now understand the value of noscripting, and I would like to learn more and discover how to create my own automation noscripts. As I don't come from a programming background, I'm searching for the best beginner resources where I can start.
Would online video tutorials, books, or articles be the way to go? Do you have any suggestions for certain courses, books, or websites that one can learn Bash noscripting from scratch, and I'd be more than happy to hear them!
https://redd.it/1izlahs
@r_bash
I don’t come from a tech or computer science background—I’m an attorney, and a significant portion of my work revolves around legal documentation. Much of my daily tasks involve repetitive processes, such as OCR (Optical Character Recognition) for scanned documents, formatting files, and managing large volumes of paperwork.
A few days back, I had a monotonous task in front of me: OCRing about 40 PDFs. Under normal circumstances, this would involve opening each document separately or using an online service, which is time-consuming and inefficient. The sheer drudgery of the task led me to wonder if there was an easier way.
That's when I approached ChatGPT for assistance. It recommended writing a Bash noscript to run the task using an ocrmypdf tool. I never wrote a noscript in my life, but I tried it. ChatGPT gave me the noscript, and as soon as I ran it, everything became really simple. Rather than handling every file separately, all I had to do was:
Put all the PDFs in one folder.
Run the noscript.
The noscript automatically produced an output folder and OCR'd all of them simultaneously.
It was an eye-opener experience. I had come to the realization that I could drastically decrease the effort spent manually doing these tasks and have a much more convenient life if I could do some basic Bash noscripting. If I am able to automate a single monotonous task, then likely several others, then hours worth of work can be saved down the road.
Where Should I Start Learning Bash Scripting?
I now understand the value of noscripting, and I would like to learn more and discover how to create my own automation noscripts. As I don't come from a programming background, I'm searching for the best beginner resources where I can start.
Would online video tutorials, books, or articles be the way to go? Do you have any suggestions for certain courses, books, or websites that one can learn Bash noscripting from scratch, and I'd be more than happy to hear them!
https://redd.it/1izlahs
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
why does rm remove "any-word*.any-ext" plus any-word01.any-ext?
**Hi**, I'd like to know why rm removes screen.jpg plus screen01jpg+screen##.... jpg **when I do rm any-word*.any-ext**?
rm screen*.jpg
*and this command deletes screen.jpg!*
how will be the command for not remove screen.jpg and yes screen01.jpg + screen02.jpg....
Thank you and Regards!
https://redd.it/1izsod6
@r_bash
**Hi**, I'd like to know why rm removes screen.jpg plus screen01jpg+screen##.... jpg **when I do rm any-word*.any-ext**?
rm screen*.jpg
*and this command deletes screen.jpg!*
how will be the command for not remove screen.jpg and yes screen01.jpg + screen02.jpg....
Thank you and Regards!
https://redd.it/1izsod6
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
I used xidel as a web scraper for scraping government job websites of Nepal (they're safe as they never update)
Can anyone recommend anything else? No problem with xidel though. I am on rocky 9
https://redd.it/1j03khv
@r_bash
Can anyone recommend anything else? No problem with xidel though. I am on rocky 9
https://redd.it/1j03khv
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
was this a good case for automation
i had a task today - change old license agreement in 500 files in git repo. The problem was that there was no single template for license agrmt, various devs and teams wrote templates in all kinds of ways - short(4 lines) and long ( 20-50 lines) in several formats
here are templates, even varied by year:
template 3:
/*
*
*
*2020 company_name.
* All Rights Reserved
* Copyright (C)
*
*
* NOTICE: All information contained herein is, and remains
* the property of company_name and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to company_name and its suppliers
* and may be covered by U.S. and Foreign Patents, patents in
* process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from company_name.
*
*
/
i cloned the repo
asked ai to write prompt to catch the files and remove the text using while loop + sed
and it did not work, then i just manually found all different templates based on "Copyright company_name" or variation of that and removed under 15 min ))
should i have done all the effort to write perfect bash noscript or i did it manually and it was good?
https://redd.it/1j0repw
@r_bash
i had a task today - change old license agreement in 500 files in git repo. The problem was that there was no single template for license agrmt, various devs and teams wrote templates in all kinds of ways - short(4 lines) and long ( 20-50 lines) in several formats
here are templates, even varied by year:
/** Copyright (C) 2020 COMPANY NAME* All Rights Reserved*/typical long full license header:-- /*-- * NOTICE: All information contained herein is, and remains-- * the property of company_name and its suppliers,-- * if any. The intellectual and technical concepts contained-- * herein are proprietary to company_name and its suppliers-- * and may be covered by U.S. and Foreign Patents, patents in-- * process, and are protected by trade secret or copyright law.-- /*template 2:/***** copyright (c) company name* All Rights Reserved*** NOTICE: All information contained herein is, and remains* the property of company_name and its suppliers,* if any. The intellectual and technical concepts contained* bla bla bla* bla bla bla* bla bla bla* from company_name.*/*/** company (c) 2019 company name* all rights reserved**//** company (c) 2020 company name* all rights reserved**/template 3:
/*
*
*
*2020 company_name.
* All Rights Reserved
* Copyright (C)
*
*
* NOTICE: All information contained herein is, and remains
* the property of company_name and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to company_name and its suppliers
* and may be covered by U.S. and Foreign Patents, patents in
* process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from company_name.
*
*
/
i cloned the repo
asked ai to write prompt to catch the files and remove the text using while loop + sed
and it did not work, then i just manually found all different templates based on "Copyright company_name" or variation of that and removed under 15 min ))
should i have done all the effort to write perfect bash noscript or i did it manually and it was good?
https://redd.it/1j0repw
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community