notes/.config/newsboat/reddit_rss/bashscripts.rss
2023-01-28 05:22:19 -08:00

1 line
No EOL
46 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/"><category term="bashscripts" label="r/bashscripts"/><updated>2023-01-28T12:44:02+00:00</updated><icon>https://www.redditstatic.com/icon.png/</icon><id>/r/bashscripts.rss</id><link rel="self" href="https://www.reddit.com/r/bashscripts.rss" type="application/atom+xml" /><link rel="alternate" href="https://www.reddit.com/r/bashscripts" type="text/html" /><subtitle>A place to share your favorite bash scripts.</subtitle><title>bash scripting</title><entry><author><name>/u/ZestyclosePush2871</name><uri>https://www.reddit.com/user/ZestyclosePush2871</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;I am trying to download content from a website. &lt;a href=&quot;http://www.tfd.chalmers.se/%7Ehani/kurser/OS_CFD_2020&quot;&gt;http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2020&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;The website has content from previous years (2021, 2020, 2019 ...). I want to particularly download the content from 2020. The url that I have pasted above takes me to the 2020 content. But when I use wget with the recursive flag, it is starting to download the wesbite content from 2021.&lt;/p&gt; &lt;p&gt;Is is because of the way the website is structured? Is there any particular way to just download content from 2020?&lt;/p&gt; &lt;p&gt;Many thanks for helping. I am new to linux commands, and I thought this would be a good challenge to begin with.&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;p&gt;EDIT:&lt;br/&gt; I am trying to see if I can I use --accept-regex option of wget, but I am not able to make it work. &lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/ZestyclosePush2871&quot;&gt; /u/ZestyclosePush2871 &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/1082ps6/help_me_with_a_wget_command/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/1082ps6/help_me_with_a_wget_command/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_1082ps6</id><link href="https://www.reddit.com/r/bashscripts/comments/1082ps6/help_me_with_a_wget_command/" /><updated>2023-01-10T06:28:11+00:00</updated><published>2023-01-10T06:28:11+00:00</published><title>Help me with a wget command</title></entry><entry><author><name>/u/sn4xchan</name><uri>https://www.reddit.com/user/sn4xchan</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;The idea is to download a zip file from that script and then move that said file to a different location after the script finishes.&lt;/p&gt; &lt;p&gt;Can anyone point me in the right direction at least?&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/sn4xchan&quot;&gt; /u/sn4xchan &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/1055dih/storing_zip_file_download_from_bash_curl_s_linksh/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/1055dih/storing_zip_file_download_from_bash_curl_s_linksh/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_1055dih</id><link href="https://www.reddit.com/r/bashscripts/comments/1055dih/storing_zip_file_download_from_bash_curl_s_linksh/" /><updated>2023-01-06T21:00:28+00:00</updated><published>2023-01-06T21:00:28+00:00</published><title>Storing zip file download from bash &lt;(curl -s &quot;link.sh&quot;) as a variable</title></entry><entry><author><name>/u/cs_moka</name><uri>https://www.reddit.com/user/cs_moka</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Could you guys help me with my task for the uni? I should to write a bash script, that helps one to serach for the author etc.&lt;/p&gt; &lt;p&gt;I need a command line that helps me do that&lt;/p&gt; &lt;p&gt;here is an example for bibtex&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;https://preview.redd.it/xirseiepzf9a1.png?width=345&amp;amp;format=png&amp;amp;auto=webp&amp;amp;s=90094fc2e92e7b1eb28599782abb87b8bfd427d0&quot;&gt;bibtex data&lt;/a&gt;&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/cs_moka&quot;&gt; /u/cs_moka &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/100ktcj/bibtex_files/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/100ktcj/bibtex_files/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_100ktcj</id><link href="https://www.reddit.com/r/bashscripts/comments/100ktcj/bibtex_files/" /><updated>2023-01-01T14:30:25+00:00</updated><published>2023-01-01T14:30:25+00:00</published><title>Bibtex files</title></entry><entry><author><name>/u/Dr_Schn3id3r</name><uri>https://www.reddit.com/user/Dr_Schn3id3r</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Hello everybody,&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;p&gt;I have read a lot of different ubuntu and linux guides about bash scripting, but I cant solve my problem.&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;p&gt;So I wanted to ask you for help with the following simple dummy code:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;#!/bin/bash # FUNCTIONS change_variable(){ variable=${value_one} echo ${variable} } # MAIN readonly value_one=1 readonly value_zero=0 variable=${value_zero} (change_variable) echo ${variable} &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;The output is:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;XPS-9315:~/Dokumente$ ./test_script 1 0 &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;So my question is, why can I not reassign the variable with a new value from insight the function?&lt;/p&gt; &lt;p&gt;PS: Does not help if I define/declare the variables before the function definition.&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;p&gt;Thank you very much and kind regards :)&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/Dr_Schn3id3r&quot;&gt; /u/Dr_Schn3id3r &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/zvab24/help_with_reassigning_variable_from_inside_script/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/zvab24/help_with_reassigning_variable_from_inside_script/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_zvab24</id><link href="https://www.reddit.com/r/bashscripts/comments/zvab24/help_with_reassigning_variable_from_inside_script/" /><updated>2022-12-26T00:08:56+00:00</updated><published>2022-12-26T00:08:56+00:00</published><title>Help with (re)assigning variable from inside script function</title></entry><entry><author><name>/u/WhoKnowsAComputerGuy</name><uri>https://www.reddit.com/user/WhoKnowsAComputerGuy</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Trying to script something I would manually do. Can you help me clean it up and show me best practice? The end goal to all this will be to add in dnf upgrade and downgrade as well as remove and install. But just keeping it simple since it will mostly be rinse and repeat.&lt;/p&gt; &lt;h1&gt;!/bin/bash&lt;/h1&gt; &lt;h1&gt;Hosts that this script applies to&lt;/h1&gt; &lt;p&gt;ALLHOSTS=&amp;quot;WS01 WS02 WS03 SRV01 SVR02 SVR03&amp;quot;&lt;/p&gt; &lt;h1&gt;Set RPM variable for script&lt;/h1&gt; &lt;p&gt;set_rpm() { echo Set RPM: read rpm }&lt;/p&gt; &lt;h1&gt;Function to Search for RPM variable on a host&lt;/h1&gt; &lt;p&gt;check_rpm() { if rpm -qa | grep &amp;quot;$rpm&amp;quot; /dev/null; then Cat /proc/sys/kernel/hostname rpm -qa &amp;quot;rpm fi }&lt;/p&gt; &lt;h1&gt;this is redundant but I want to keep the formula for future things for now&lt;/h1&gt; &lt;p&gt;select_01() { Select_rpm }&lt;/p&gt; &lt;h1&gt;SSH to each host and check for rpm&lt;/h1&gt; &lt;p&gt;select_02() { for HOSTNAME IN $ALLHOSTS;do ssh -qa -tt $HOSTNAME &amp;quot;$ (typeset -f); check_rpm&amp;quot; | tee log.rpms done }&lt;/p&gt; &lt;h1&gt;Start of menu selection&lt;/h1&gt; &lt;p&gt;press_enter() { echo &amp;quot;&amp;quot; echo -n &amp;quot;Press Enter to continue&amp;quot; read clear }&lt;/p&gt; &lt;p&gt;until [ &amp;quot;Selection&amp;quot; = &amp;quot;0&amp;quot; ]; do clear echo &amp;quot;Please select what you want to complete&amp;quot; echo &amp;quot;&amp;quot; echo &amp;quot;. 1. -. Set rpm variable &amp;quot; echo &amp;quot;. 2. -. Check for rpm&amp;quot; echo -n &amp;quot; Enter Selection&amp;quot; read selection case $selection in 1) clear ; select_01 ; press_enter ;; 2) clear ; select_02 ; press_enter ;; 0) clear ; exit ;; esac done&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/WhoKnowsAComputerGuy&quot;&gt; /u/WhoKnowsAComputerGuy &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/zk93on/im_a_beginner/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/zk93on/im_a_beginner/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_zk93on</id><link href="https://www.reddit.com/r/bashscripts/comments/zk93on/im_a_beginner/" /><updated>2022-12-12T19:40:47+00:00</updated><published>2022-12-12T19:40:47+00:00</published><title>I'm a beginner</title></entry><entry><author><name>/u/Wowiezowieee</name><uri>https://www.reddit.com/user/Wowiezowieee</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;I need to explain what this script does for a question on my classwork but my teacher isn&amp;#39;t satisfied with my answer. Can anyone provide some insight into what exactly is happening with this script?&lt;/p&gt; &lt;p&gt;#!/bin/bash&lt;/p&gt; &lt;p&gt;if [ -z “$1” -o -r “$2” ]; then&lt;/p&gt; &lt;p&gt;echo “Usage: myscript [file] [size]” &lt;/p&gt; &lt;p&gt;exit 255&lt;/p&gt; &lt;p&gt;fi&lt;/p&gt; &lt;p&gt;SIZE=`ls -l $1 | awk {print $5}`&lt;/p&gt; &lt;p&gt;if [ $2 -gt $SIZE ]; then&lt;/p&gt; &lt;p&gt;echo “Your size must be smaller than the file size!”&lt;/p&gt; &lt;p&gt;exit 254&lt;/p&gt; &lt;p&gt;fi&lt;/p&gt; &lt;p&gt;CHUNK=$2&lt;/p&gt; &lt;p&gt;TOTAL=0&lt;/p&gt; &lt;p&gt;PASS=0&lt;/p&gt; &lt;p&gt;while [ $TOTAL -lt $SIZE ]; do&lt;/p&gt; &lt;p&gt;PASS=$((PASS + 1))&lt;/p&gt; &lt;p&gt;echo “Creating $1.$PASS …”&lt;/p&gt; &lt;p&gt;dd conv=noerror if=$1 of=$1.$PASS bs=$CHUNK skip=$((PASS 1)) \&lt;/p&gt; &lt;p&gt;count=1 2&amp;gt;/dev/null&lt;/p&gt; &lt;p&gt;TOTAL=$((TOTAL + CHUNK))&lt;/p&gt; &lt;p&gt;done&lt;/p&gt; &lt;p&gt;echo “Created $PASS files out of $1.”&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/Wowiezowieee&quot;&gt; /u/Wowiezowieee &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/z6byni/what_does_this_script_do/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/z6byni/what_does_this_script_do/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_z6byni</id><link href="https://www.reddit.com/r/bashscripts/comments/z6byni/what_does_this_script_do/" /><updated>2022-11-27T20:40:45+00:00</updated><published>2022-11-27T20:40:45+00:00</published><title>What does this script do</title></entry><entry><author><name>/u/3_Thumbs_Up</name><uri>https://www.reddit.com/user/3_Thumbs_Up</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Long story short, because of a weird quirk with my ISP I want to restart my router automatically every night. I have a Linux server on my lan, so ideally, I would simply have my server run a script that does this for me.&lt;/p&gt; &lt;p&gt;In order to restart my router manually, I need to login to my router, press, a button in the top left corner, and then confirm my choice. That&amp;#39;s it. I assume there are some Linux tools that can already do something like this, but I&amp;#39;m uncertain where to start.&lt;/p&gt; &lt;p&gt;The log in page seems like the big hurdle here. Otherwise i guess it could be done with a curl oneliner.&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/3_Thumbs_Up&quot;&gt; /u/3_Thumbs_Up &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/z1sslh/bash_interaction_with_web_frontend/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/z1sslh/bash_interaction_with_web_frontend/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_z1sslh</id><link href="https://www.reddit.com/r/bashscripts/comments/z1sslh/bash_interaction_with_web_frontend/" /><updated>2022-11-22T12:50:12+00:00</updated><published>2022-11-22T12:50:12+00:00</published><title>Bash interaction with web frontend</title></entry><entry><author><name>/u/Utelys</name><uri>https://www.reddit.com/user/Utelys</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;So i need to make a script that transfers a backup from one system to another remote system using ssh, but I am not sure how I will be doing this, can anyone give some tips to help me complete this task?&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;https://preview.redd.it/b8efrptbxwz91.png?width=639&amp;amp;format=png&amp;amp;auto=webp&amp;amp;s=7af14b27fc12c626135b8eeef766a9d985fd02b1&quot;&gt;https://preview.redd.it/b8efrptbxwz91.png?width=639&amp;amp;format=png&amp;amp;auto=webp&amp;amp;s=7af14b27fc12c626135b8eeef766a9d985fd02b1&lt;/a&gt;&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/Utelys&quot;&gt; /u/Utelys &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/yuyb9a/having_trouble_with_this_task_anyone_wanna_point/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/yuyb9a/having_trouble_with_this_task_anyone_wanna_point/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_yuyb9a</id><link href="https://www.reddit.com/r/bashscripts/comments/yuyb9a/having_trouble_with_this_task_anyone_wanna_point/" /><updated>2022-11-14T12:45:42+00:00</updated><published>2022-11-14T12:45:42+00:00</published><title>Having trouble with this task anyone wanna point me in the right direction?</title></entry><entry><author><name>/u/hi-low_20</name><uri>https://www.reddit.com/user/hi-low_20</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Looking to make a script to automate video downloads. The process normally goes like this: 1. YouTube-dl &amp;#39;url-to-vid&amp;#39; (this will download an HTML) 2. Open HTML and search for &amp;quot;data-src&amp;quot; (so far only two lines have returned with this search, one relating to a .mp4 and another .jpg, we need the url for the .mp4) 3. Copy &amp;amp; paste url again with YouTube-dl and then rename the file using the name of the HTML file. 4. rm original HTML file.&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/hi-low_20&quot;&gt; /u/hi-low_20 &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/xtu92b/bash_script_to_automate_video_downloads/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/xtu92b/bash_script_to_automate_video_downloads/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_xtu92b</id><link href="https://www.reddit.com/r/bashscripts/comments/xtu92b/bash_script_to_automate_video_downloads/" /><updated>2022-10-02T17:18:18+00:00</updated><published>2022-10-02T17:18:18+00:00</published><title>Bash script to automate video downloads</title></entry><entry><author><name>/u/JasonCM8</name><uri>https://www.reddit.com/user/JasonCM8</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;I found this bash script in the ask ubuntu forum and it works, but I would like to know if it can be used or improved to know if a tiktok stream is live or off, using the bash script via terminal (./test.url.sh /url.txt) in the .txt would be the tiktok addresses for example: &lt;/p&gt; &lt;p&gt;&lt;a href=&quot;https://www.tiktok.com/@xxxxxx/live&quot;&gt;https://www.tiktok.com/@xxxxxx/live&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;https://www.tiktok.com/@cccccc/live&quot;&gt;https://www.tiktok.com/@cccccc/live&lt;/a&gt;&lt;/p&gt; &lt;p&gt;and that in the terminal tell me if it is live or off, is it possible? &lt;/p&gt; &lt;p&gt;#!/bin/bash &lt;/p&gt; &lt;p&gt;if [ $# -eq 0 ]&lt;br/&gt; then&lt;br/&gt; fin=-&lt;br/&gt; else&lt;br/&gt; fin=$1&lt;br/&gt; fi &lt;/p&gt; &lt;p&gt;urlarr=( $(cat $fin | strings | grep &amp;#39;://&amp;#39; | grep -i &amp;quot;\.com\|\.net\|\.edu\|\.org\|[0-9].*\.[0-9].*\.[0-9].*\.[0-9].*&amp;quot; | tr &amp;#39;\n&amp;#39; &amp;#39; &amp;#39; ) ) &lt;/p&gt; &lt;p&gt;for i in ${urlarr[@]}&lt;br/&gt; do&lt;br/&gt; if wget -q --tries=1 --no-cache --spider -O /dev/null --ignore-length -T 1 &amp;quot;$i&amp;quot;&lt;br/&gt; then&lt;br/&gt; echo $i is good.&lt;br/&gt; else&lt;br/&gt; echo $i is bad.&lt;br/&gt; fi&lt;br/&gt; done &lt;/p&gt; &lt;p&gt;exit $?&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/JasonCM8&quot;&gt; /u/JasonCM8 &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/xo4uim/bash_script_to_determine_if_a_streaming_is_live/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/xo4uim/bash_script_to_determine_if_a_streaming_is_live/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_xo4uim</id><link href="https://www.reddit.com/r/bashscripts/comments/xo4uim/bash_script_to_determine_if_a_streaming_is_live/" /><updated>2022-09-26T01:11:50+00:00</updated><published>2022-09-26T01:11:50+00:00</published><title>Bash script to determine if a streaming is live or off</title></entry><entry><author><name>/u/data_rock</name><uri>https://www.reddit.com/user/data_rock</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;I have a lot of scripts i wrote to quickly ssh into servers. Usually in the format&lt;/p&gt; &lt;p&gt;Eg. filename is: server-script1.sh &lt;code&gt; cat server-script1.sh &lt;/code&gt;&lt;/p&gt; &lt;p&gt;```&lt;/p&gt; &lt;h1&gt;!/bin/bash&lt;/h1&gt; &lt;p&gt;ssh -i key.pem &lt;a href=&quot;mailto:user@10.10.10.1&quot;&gt;user@10.10.10.1&lt;/a&gt;&lt;/p&gt; &lt;p&gt;```&lt;/p&gt; &lt;p&gt;Im not too familiar with sed and awk. Those are what i came across in my search for a solution. &lt;/p&gt; &lt;p&gt;I want to add the filename as a comment in the second line for each file so that they all come out in this way:&lt;/p&gt; &lt;p&gt;```&lt;/p&gt; &lt;h1&gt;!/bin/bash&lt;/h1&gt; &lt;h1&gt;server-script1.sh&lt;/h1&gt; &lt;p&gt;ssh -i key.pem &lt;a href=&quot;mailto:user@10.10.10.1&quot;&gt;user@10.10.10.1&lt;/a&gt; ```&lt;/p&gt; &lt;p&gt;```&lt;/p&gt; &lt;h1&gt;!/bin/bash&lt;/h1&gt; &lt;h1&gt;server-script2.sh&lt;/h1&gt; &lt;p&gt;ssh -i key.pem &lt;a href=&quot;mailto:user@10.10.10.2&quot;&gt;user@10.10.10.2&lt;/a&gt; ```&lt;/p&gt; &lt;p&gt;Any suggestions on how to do this? Thanks&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/data_rock&quot;&gt; /u/data_rock &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/xdpt4i/script_for_appending_title_to_2nd_line_of_other/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/xdpt4i/script_for_appending_title_to_2nd_line_of_other/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_xdpt4i</id><link href="https://www.reddit.com/r/bashscripts/comments/xdpt4i/script_for_appending_title_to_2nd_line_of_other/" /><updated>2022-09-14T02:20:34+00:00</updated><published>2022-09-14T02:20:34+00:00</published><title>Script for appending title to 2nd line of other scripts</title></entry><entry><author><name>/u/joeymatthews</name><uri>https://www.reddit.com/user/joeymatthews</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/joeymatthews&quot;&gt; /u/joeymatthews &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;/r/rclone/comments/x9xrv7/bash_script_to_connect_two_drives/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/x9xvvm/bash_script_to_connect_two_drives/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_x9xvvm</id><link href="https://www.reddit.com/r/bashscripts/comments/x9xvvm/bash_script_to_connect_two_drives/" /><updated>2022-09-09T15:06:06+00:00</updated><published>2022-09-09T15:06:06+00:00</published><title>Bash script to connect two drives</title></entry><entry><author><name>/u/AnOriginalName2021</name><uri>https://www.reddit.com/user/AnOriginalName2021</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;What I wanted to accomplish is when I insert a SD card into a USB reader on my R PI 4+ it would automatically copy the files to a network share and organize them by date, This script DOESN&amp;quot;T DO IT/ I also want it to send me an email when the transfers are done and advise me of any problems (it doesn&amp;#39;t do that either)&lt;/p&gt; &lt;p&gt;What it does is when run (I plan on running it as a CRON job) it checks if specific SD cards are installed then copies specific folders from them. My idea is if I keep a list of what card is is which dashcam my if commands will work. Right now I&amp;#39;m using Rsync to copy all the files. I&amp;#39;m going to want to change that to only copy new files.. Once they are copied I am going to manually sort them in folders until I can figure out how to do that based on a script.&lt;/p&gt; &lt;p&gt;I should have 8 hours of time available to copy before I have to take the cards and put them back in the camera.&lt;/p&gt; &lt;p&gt;My code is below.&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;pre&gt;&lt;code&gt;#!/bin/bash clear #touch &amp;quot;/home/dashcam/canary/SD_SCRIPT.canary&amp;quot; #if [ ! -f &amp;quot;/home/dashcam/canary/SD_SCRIPT.canary&amp;quot; ] #then echo &amp;quot;Copy Script Failed Aborting Run&amp;quot; #fi #exit 1 echo &amp;quot;Checking for SD Cards&amp;quot; sleep 2 echo &amp;quot;checking for Lamando Card&amp;quot; sleep 5 if [ -d &amp;quot;/media/dashcam/6310-5AE7/rearVideo1&amp;quot; ]; then echo &amp;quot;SD Card for Lamando is inserted&amp;quot; echo &amp;quot; Copying Files Front Camera Files&amp;quot; rsync -a -P /media/dashcam/6310-5AE7/frontVideo0/* /synology-nas/shared/DashCam/ echo &amp;quot;Complete&amp;quot; echo &amp;quot; Copying Rear Camera Files&amp;quot; rsync -a -P /media/dashcam/6310-5AE7/rearVideo1/* /synology-nas/shared/DashCam/ echo &amp;quot;Complete&amp;quot; sleep 2 else echo &amp;quot;Lamando Card Not Found&amp;quot; fi echo &amp;quot;Checking for VaVa Card&amp;quot; if [ -d &amp;quot;/media/dashcam/VA-VD009/VAVA&amp;quot; ]; then echo &amp;quot;SD Card for Vava is inserted&amp;quot; echo &amp;quot;Copying Video Files&amp;quot; rsync -a -P /media/dashcam/VA-VD009/VAVA/MOVIE/* /synology-nas/shared/DashCam echo &amp;quot;Complete&amp;quot; echo &amp;quot;Copying GPS data&amp;quot; rsync -a -P /media/dashcam/VA-VD009/VAVA/GPSDATA/* /synology-nas/shared/DashCam else echo &amp;quot;VaVa Card Not Found&amp;quot; fi echo &amp;quot;unmounting cards&amp;quot; sleep 3 if [ -d &amp;quot;/media/dashcam/6310-5AE7/rearVideo1&amp;quot; ]; then umount /media/dashcam/6310-5AE7 fi if [ -d &amp;quot;/media/dashcam/VA-VD009/VAVA&amp;quot; ]; then umount /media/dashcam/VA-VD009 fi sleep 3 echo &amp;quot;All cards unmounted you can now safely remove them&amp;quot; &lt;/code&gt;&lt;/pre&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/AnOriginalName2021&quot;&gt; /u/AnOriginalName2021 &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/x3shpf/help_me_improve_my_first_bash_script/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/x3shpf/help_me_improve_my_first_bash_script/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_x3shpf</id><link href="https://www.reddit.com/r/bashscripts/comments/x3shpf/help_me_improve_my_first_bash_script/" /><updated>2022-09-02T04:44:28+00:00</updated><published>2022-09-02T04:44:28+00:00</published><title>Help me improve my first Bash Script</title></entry><entry><author><name>/u/vakennu</name><uri>https://www.reddit.com/user/vakennu</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;I&amp;#39;m looking for recommendations for solutions to create an exportable GUI for my shell scripts. Exportable = copying to other computers with no additional software on the target computers needed.&lt;/p&gt; &lt;p&gt;This is for MACOS and if I get around using the Apple app store that would be best.&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/vakennu&quot;&gt; /u/vakennu &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/mnm7sa/creating_an_exportable_gui_for_macos/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/mnm7sa/creating_an_exportable_gui_for_macos/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_mnm7sa</id><link href="https://www.reddit.com/r/bashscripts/comments/mnm7sa/creating_an_exportable_gui_for_macos/" /><updated>2021-04-09T17:25:10+00:00</updated><published>2021-04-09T17:25:10+00:00</published><title>Creating an &quot;exportable&quot; GUI for MACOS</title></entry><entry><author><name>/u/zebbodee</name><uri>https://www.reddit.com/user/zebbodee</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Hardly a script, but I was hoping to make an alias of sorts on my osmc install/raspberry pi for mediainfo to create the nfo file. In essence I just want to pass in the arguments for the file name as per the below:&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;p&gt;&lt;code&gt;mediainfo --LogFile=nfo_file_name.nfo movie.avi&lt;/code&gt;&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;p&gt;I have the below which cuts off the file extension, I tested it with echo to confirm the correct output but it doesn&amp;#39;t work when applied to mediainfo, just wondered if you can tell why.&lt;/p&gt; &lt;p&gt;Test:&lt;br/&gt; &lt;code&gt;function nfo () { /bin/echo ${1::-3}nfo &amp;quot;$1&amp;quot; ;}&lt;/code&gt;&lt;/p&gt; &lt;p&gt;mediainfo&lt;/p&gt; &lt;p&gt;&lt;code&gt;function nfo () { /usr/bin/mediainfo ${1::-3}nfo &amp;quot;$1&amp;quot; ;}&lt;/code&gt;&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;p&gt;The outputs: &lt;/p&gt; &lt;p&gt;Test Function-&lt;br/&gt; &lt;code&gt;$ nfo 12.Angry.Men.1957.720p.mp4&lt;/code&gt;&lt;/p&gt; &lt;p&gt;&lt;code&gt;12.Angry.Men.1957.720p.nfo 12.Angry.Men.1957.720p.mp4&lt;/code&gt;&lt;/p&gt; &lt;p&gt;Which should feed the correct arguments as strings to the media info program.&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;p&gt;When I try with the mediainfo version I get the following: &lt;/p&gt; &lt;p&gt;&lt;code&gt;nfo 12.Angry.Men.1957.720p.mp4&lt;/code&gt;&lt;/p&gt; &lt;p&gt;&lt;code&gt;General&lt;/code&gt;&lt;/p&gt; &lt;p&gt;&lt;code&gt;Complete name : 12.Angry.Men.1957.720p.mp4&lt;/code&gt;&lt;/p&gt; &lt;p&gt;&lt;code&gt;Format : MPEG-4&lt;/code&gt;&lt;/p&gt; &lt;p&gt;&lt;code&gt;Format profile : Base Media&lt;/code&gt;&lt;/p&gt; &lt;p&gt;... &amp;lt;Rest of the NFO output&amp;gt; But no nfo file is created.&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;p&gt;I was thinking I could redirect the output to a new file called $1.nfo but when run &amp;quot;manually&amp;quot; the nfo file is created. I just can&amp;#39;t figure out why not for the above.&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/zebbodee&quot;&gt; /u/zebbodee &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/mnhskn/mediainfo_nfo_file_function/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/mnhskn/mediainfo_nfo_file_function/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_mnhskn</id><link href="https://www.reddit.com/r/bashscripts/comments/mnhskn/mediainfo_nfo_file_function/" /><updated>2021-04-09T13:58:48+00:00</updated><published>2021-04-09T13:58:48+00:00</published><title>Mediainfo NFO file function</title></entry><entry><author><name>/u/cheerupcharlie</name><uri>https://www.reddit.com/user/cheerupcharlie</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Hello Shell Scripters!&lt;/p&gt; &lt;p&gt;At work, I&amp;#39;ve been asked to verify if some PowerShell challenges issued to interviewees could be solved in Bash for certain sysadmin candidates.&lt;/p&gt; &lt;p&gt;I&amp;#39;ve provided solutions for all of them except one. Well, I did provide a solution, but it&amp;#39;s a hack, and I&amp;#39;m racking my brain to think about how to solve it properly:&lt;/p&gt; &lt;p&gt;&lt;em&gt;Write a script that, for each number from 1 to 100, prints a comma-delimited list of numbers in descending order from the current number to 1. Each list should be shown on a separate line as seen below.&lt;/em&gt;&lt;/p&gt; &lt;pre&gt;&lt;code&gt;1 2,1 3,2,1 4,3,2,1 ... 100,99,...,1 &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;Example Solution (from 10 to save space). Originally, I did this:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;for x in {1..10}; do for i in {$x..1}; do echo -n $i,; done; echo &amp;quot;&amp;quot;; done &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;But then I noticed the trailing commas and the end of each line. I then submitted this instead (admitting &amp;quot;OK, I cheated shaving off the trailing comma.&amp;quot;)&lt;/p&gt; &lt;pre&gt;&lt;code&gt;echo &amp;quot;1&amp;quot;; for x in {2..10}; do for i in {$x..2}; do echo -n $i,; done; echo -n &amp;quot;1&amp;quot;; echo &amp;quot;&amp;quot;; done &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;Example Output&lt;/p&gt; &lt;pre&gt;&lt;code&gt;1 2,1 3,2,1 4,3,2,1 5,4,3,2,1 6,5,4,3,2,1 7,6,5,4,3,2,1 8,7,6,5,4,3,2,1 9,8,7,6,5,4,3,2,1 10,9,8,7,6,5,4,3,2,1 &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;My boss laughed and admitted she added a &lt;code&gt;().trimend(&amp;quot;,&amp;quot;)&lt;/code&gt; in the PS solution. &lt;/p&gt; &lt;p&gt;What&amp;#39;s the proper way to shave off the trailing comma in a situation like this? Any ideas?&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: the solution doesn&amp;#39;t have to be a one-liner, but brevity is appreciated. It&amp;#39;s not a &amp;quot;programming&amp;quot; test, but it is a way to see how the interviewee approaches a problem.&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/cheerupcharlie&quot;&gt; /u/cheerupcharlie &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/mm0e5n/help_with_shell_script_challenge/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/mm0e5n/help_with_shell_script_challenge/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_mm0e5n</id><link href="https://www.reddit.com/r/bashscripts/comments/mm0e5n/help_with_shell_script_challenge/" /><updated>2021-04-07T11:56:12+00:00</updated><published>2021-04-07T11:56:12+00:00</published><title>Help with shell script challenge</title></entry><entry><author><name>/u/Sirenagrace_</name><uri>https://www.reddit.com/user/Sirenagrace_</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/Sirenagrace_&quot;&gt; /u/Sirenagrace_ &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://i.redd.it/l2j6wqd6ryp61.jpg&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/mfotko/whats_the_error_in_this_code/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_mfotko</id><link href="https://www.reddit.com/r/bashscripts/comments/mfotko/whats_the_error_in_this_code/" /><updated>2021-03-29T12:47:16+00:00</updated><published>2021-03-29T12:47:16+00:00</published><title>Whats the error in this code ?</title></entry><entry><author><name>/u/Sirenagrace_</name><uri>https://www.reddit.com/user/Sirenagrace_</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;How to write a script that can be run from any directory it is placed within users Linux directory structure?&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/Sirenagrace_&quot;&gt; /u/Sirenagrace_ &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/mcq5yh/how_to_code_this_i_need_help/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/mcq5yh/how_to_code_this_i_need_help/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_mcq5yh</id><link href="https://www.reddit.com/r/bashscripts/comments/mcq5yh/how_to_code_this_i_need_help/" /><updated>2021-03-25T04:44:12+00:00</updated><published>2021-03-25T04:44:12+00:00</published><title>How to code this? I need help</title></entry><entry><author><name>/u/Sirenagrace_</name><uri>https://www.reddit.com/user/Sirenagrace_</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/Sirenagrace_&quot;&gt; /u/Sirenagrace_ &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://i.redd.it/ohnkv6621un61.jpg&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/m7xs80/can_someone_please_tell_me_whats_the_error_in_the/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_m7xs80</id><link href="https://www.reddit.com/r/bashscripts/comments/m7xs80/can_someone_please_tell_me_whats_the_error_in_the/" /><updated>2021-03-18T18:45:25+00:00</updated><published>2021-03-18T18:45:25+00:00</published><title>Can someone please tell me whats the error in the equation part of the code?</title></entry><entry><author><name>/u/RealityGoneNuts2610k</name><uri>https://www.reddit.com/user/RealityGoneNuts2610k</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;I&amp;#39;m working on automation in linux and I can&amp;#39;t figure out how to detect if someone uses ctrl-c or escape key or when the terminal is forced closed and create condition that pop-up the dialogue and give a warning message or save options. Any example is appreciated.&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/RealityGoneNuts2610k&quot;&gt; /u/RealityGoneNuts2610k &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/lvwfu1/how_to_include_keyboard_interrupt_like_ctrlc_in/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/lvwfu1/how_to_include_keyboard_interrupt_like_ctrlc_in/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_lvwfu1</id><link href="https://www.reddit.com/r/bashscripts/comments/lvwfu1/how_to_include_keyboard_interrupt_like_ctrlc_in/" /><updated>2021-03-02T07:23:56+00:00</updated><published>2021-03-02T07:23:56+00:00</published><title>How to include keyboard interrupt like &quot;ctrl-c&quot; in &quot;if-else&quot; state condition.</title></entry><entry><author><name>/u/lozanomatheus</name><uri>https://www.reddit.com/user/lozanomatheus</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;I just wrote this post. I&amp;#39;m showing an OSS tool that can easily keep things updated on *NIX/Windows and/or easily switch between versions. It&amp;#39;s very useful on Bash/Zsh/Fish scripts that you need to switch between versions.&lt;/p&gt; &lt;p&gt;Feedbacks/suggestions/* are always welcome :)&lt;/p&gt; &lt;p&gt;See on Medium: &lt;a href=&quot;https://medium.com/bash-tips-and-tricks/an-easy-way-to-switch-between-runtime-versions-nodejs-terraform-and-279-53fdfbcb4049?sk=43548418bf394d80e277a39a76070843&quot;&gt;https://medium.com/bash-tips-and-tricks/an-easy-way-to-switch-between-runtime-versions-nodejs-terraform-and-279-53fdfbcb4049?sk=43548418bf394d80e277a39a76070843&lt;/a&gt;&lt;/p&gt; &lt;p&gt;See on my Website: &lt;a href=&quot;https://www.lozanomatheus.com/post/an-easy-way-to-switch-between-runtime-versions-nodejs-terraform-and-279&quot;&gt;https://www.lozanomatheus.com/post/an-easy-way-to-switch-between-runtime-versions-nodejs-terraform-and-279&lt;/a&gt;&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/lozanomatheus&quot;&gt; /u/lozanomatheus &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/lm5805/blog_a_cli_tool_that_can_easily_manage_more_than/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/lm5805/blog_a_cli_tool_that_can_easily_manage_more_than/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_lm5805</id><link href="https://www.reddit.com/r/bashscripts/comments/lm5805/blog_a_cli_tool_that_can_easily_manage_more_than/" /><updated>2021-02-17T21:29:38+00:00</updated><published>2021-02-17T21:29:38+00:00</published><title>[Blog] A CLI tool that can easily manage more than 281 runtimes, making it easy to keep things updated and/or switching between versions. And its open-source :)</title></entry><entry><author><name>/u/denisde4ev</name><uri>https://www.reddit.com/user/denisde4ev</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;for people who dont want a separate keybindings just for rarely used variety&lt;/p&gt; &lt;p&gt;just use variety-loop with just 1 key press and will do (next, previous, trash, favorite or quit)&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;https://pastebin.com/L3ejkcEw&quot;&gt;https://pastebin.com/L3ejkcEw&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;p&gt;usage example:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;$ variety-loop Useage: variety -&amp;lt;input&amp;gt; --* -&amp;gt; read more than 1 char -q -&amp;gt; --quit (Also quits from ^D) -n -&amp;gt; --next -p -&amp;gt; --previous -t -&amp;gt; --trash -f -&amp;gt; --favorite variety -&amp;lt;&amp;lt; WAITS FOR INPUT &amp;gt;&amp;gt; &lt;/code&gt;&lt;/pre&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/denisde4ev&quot;&gt; /u/denisde4ev &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/lj5bh6/i_wrote_a_small_script_varietyloop/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/lj5bh6/i_wrote_a_small_script_varietyloop/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_lj5bh6</id><link href="https://www.reddit.com/r/bashscripts/comments/lj5bh6/i_wrote_a_small_script_varietyloop/" /><updated>2021-02-13T17:51:12+00:00</updated><published>2021-02-13T17:51:12+00:00</published><title>I wrote a small script - variety-loop</title></entry><entry><author><name>/u/lozanomatheus</name><uri>https://www.reddit.com/user/lozanomatheus</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Hey,&lt;/p&gt; &lt;p&gt;Two days ago I wrote this blog exploring the scope of the Bash variables and the types. I&amp;#39;m explaining their differences, how and when to use each one of them. Feel free to give any feedback/suggestion/* :)&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;p&gt;See on Medium: &lt;a href=&quot;https://medium.com/unboxing-the-cloud/bash-variables-things-that-you-probably-dont-know-about-it-8a5470887331?sk=26693ca772a0c54c99d3712303560ed4&quot;&gt;https://medium.com/unboxing-the-cloud/bash-variables-things-that-you-probably-dont-know-about-it-8a5470887331?sk=26693ca772a0c54c99d3712303560ed4&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;p&gt;See on my Website: &lt;a href=&quot;https://www.lozanomatheus.com/post/bash-variables-things-that-you-probably-don-t-know-about-it&quot;&gt;https://www.lozanomatheus.com/post/bash-variables-things-that-you-probably-don-t-know-about-it&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;#x200B;&lt;/p&gt; &lt;p&gt;Sorry, I&amp;#39;m pretty new on Reddit, I &lt;del&gt;accidentally&lt;/del&gt; deleted the original post...&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/lozanomatheus&quot;&gt; /u/lozanomatheus &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/linfh6/blog_bash_variables_things_that_you_probably_dont/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/linfh6/blog_bash_variables_things_that_you_probably_dont/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_linfh6</id><link href="https://www.reddit.com/r/bashscripts/comments/linfh6/blog_bash_variables_things_that_you_probably_dont/" /><updated>2021-02-12T23:13:41+00:00</updated><published>2021-02-12T23:13:41+00:00</published><title>[Blog] Bash variables — Things that you probably dont know about it</title></entry><entry><author><name>/u/lozanomatheus</name><uri>https://www.reddit.com/user/lozanomatheus</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/lozanomatheus&quot;&gt; /u/lozanomatheus &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;/r/devops/comments/l7akge/blog_how_to_trigger_an_action_at_the_end_of_the/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/l7anth/blog_how_to_trigger_an_action_at_the_end_of_the/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_l7anth</id><link href="https://www.reddit.com/r/bashscripts/comments/l7anth/blog_how_to_trigger_an_action_at_the_end_of_the/" /><updated>2021-01-28T22:17:39+00:00</updated><published>2021-01-28T22:17:39+00:00</published><title>[Blog] How to trigger an action at the end of the Shell/Bash script</title></entry><entry><author><name>/u/lozanomatheus</name><uri>https://www.reddit.com/user/lozanomatheus</uri></author><category term="bashscripts" label="r/bashscripts"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Hello there,&lt;/p&gt; &lt;p&gt;A few weeks ago I started my blog which I&amp;#39;ll focus on Tips and Tricks. I wrote only two posts until now, soon I&amp;#39;ll bring more. The idea is to bring some stuff that I use/know on a daily basis and it may be useful for others too. I&amp;#39;m trying to keep as simple as possible with some practical examples (+ external links that could explain in-deep, in case someone wants to know more :) ).&lt;/p&gt; &lt;p&gt;Any feedback is more than welcome :)&lt;/p&gt; &lt;p&gt;How to send a TCP request with Bash native feature (e.g.: you can do test an HTTP endpoint without installing cURL / Wget / etc)&lt;br/&gt; &lt;a href=&quot;https://medium.com/bash-tips-and-tricks/part01-tcp-udp-request-with-a-native-bash-feature-and-without-curl-wget-9dcef59c30aa&quot;&gt;https://medium.com/bash-tips-and-tricks/part01-tcp-udp-request-with-a-native-bash-feature-and-without-curl-wget-9dcef59c30aa&lt;/a&gt;&lt;/p&gt; &lt;p&gt;How to get the Linux IP address without ip/ifconfig&lt;br/&gt; &lt;a href=&quot;https://medium.com/bash-tips-and-tricks/getting-the-linux-ip-address-without-any-package-ifconfig-ip-address-etc-7b1363077964&quot;&gt;https://medium.com/bash-tips-and-tricks/getting-the-linux-ip-address-without-any-package-ifconfig-ip-address-etc-7b1363077964&lt;/a&gt;&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/lozanomatheus&quot;&gt; /u/lozanomatheus &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/knbh3a/some_tickstips_for_bash_script_http_request_with/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/bashscripts/comments/knbh3a/some_tickstips_for_bash_script_http_request_with/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_knbh3a</id><link href="https://www.reddit.com/r/bashscripts/comments/knbh3a/some_tickstips_for_bash_script_http_request_with/" /><updated>2020-12-30T21:39:39+00:00</updated><published>2020-12-30T21:39:39+00:00</published><title>Some ticks/tips for Bash script - HTTP request with a Bash native function -- Get IP Address without ip/ifconfig</title></entry></feed>