Bash Programming

bash script: RSS Feed Reader Script


#!/bin/bash

# RSS feed URLs
rss_feeds=(
"https://example.com/rss"
"https://another-example.com/rss"
)

# Function to fetch and display latest articles from RSS feeds
fetch_latest_articles() {
for rss_feed in "${rss_feeds[@]}"
do
echo "Latest articles from $rss_feed:"
curl -s $rss_feed | grep -o '[^<]*' | sed 's/<title>//'<br /> echo "-------------------"<br /> done<br /> }</p> <p># Main script<br /> fetch_latest_articles<br /> </code></p> <p>The bash script provided is a simple RSS Feed Reader Script. It fetches and displays the latest articles from RSS feeds in a customizable format.</p> <p>The script starts by defining an array `rss_feeds` that contains the URLs of the RSS feeds from which we want to fetch the latest articles.</p> <p>Next, there is a function `fetch_latest_articles` that iterates over each RSS feed URL, fetches the content using `curl`, extracts the article titles using `grep` and `sed`, and then displays the titles on the console.</p> <p>In the main part of the script, the `fetch_latest_articles` function is called to execute the fetching and displaying of the latest articles from the RSS feeds.</p> <p>This script can be further customized by adding additional processing of the fetched data, error handling, or formatting options as per the requirements.</p> </div><!-- .entry-content --> <footer class="tag-btns mt-5 mb-2"> <a href="http://cyberiqcrew.com/index.php/tag/bash/" class="tagbtn shadow">bash</a><a href="http://cyberiqcrew.com/index.php/tag/bash-script/" class="tagbtn shadow">bash script</a><a href="http://cyberiqcrew.com/index.php/tag/display/" class="tagbtn shadow">display</a><a href="http://cyberiqcrew.com/index.php/tag/fetch/" class="tagbtn shadow">fetch</a><a href="http://cyberiqcrew.com/index.php/tag/reader/" class="tagbtn shadow">reader</a><a href="http://cyberiqcrew.com/index.php/tag/rss-feed/" class="tagbtn shadow">RSS feed</a> </footer><!-- .entry-footer --> </div> </div> </article><!-- #post-1699 --> <nav class="navigation post-navigation" aria-label="Posts"> <h2 class="screen-reader-text">Post navigation</h2> <div class="nav-links"><div class="nav-previous"><a href="http://cyberiqcrew.com/index.php/1698/bash-script-dynamic-wallpaper-changer-script/" rel="prev"><span class="nav-subtitle">Previous:</span> <span class="nav-title">bash script: Dynamic Wallpaper Changer Script</span></a></div><div class="nav-next"><a href="http://cyberiqcrew.com/index.php/1700/bash-script-code-snippet-manager-script/" rel="next"><span class="nav-subtitle">Next:</span> <span class="nav-title">bash script: Code Snippet Manager Script</span></a></div></div> </nav> </main><!-- #main --> </div> <div class="col-lg-3 widget-sidebar"> <aside id="secondary" class="widget-area"> <section id="block-7" class="widget bg-light mb-4 p-3 widget_block widget_search"><form role="search" method="get" action="http://cyberiqcrew.com/" class="wp-block-search__button-outside wp-block-search__text-button wp-block-search" ><label class="wp-block-search__label" for="wp-block-search__input-1" >Search</label><div class="wp-block-search__inside-wrapper " ><input class="wp-block-search__input" id="wp-block-search__input-1" placeholder="" value="" type="search" name="s" required /><button aria-label="Search" class="wp-block-search__button wp-element-button" type="submit" >Search</button></div></form></section> <section id="mpdw-recent-posts-3" class="widget bg-light mb-4 p-3 mgpd_Recent_Posts"> <h2 class="widget-title">Recent Posts</h2> <ul class="mpdw-recent-posts onestyle"> <li class="mpdw-recent-item mb-3"> <div class="row"> <div class="col-sm-4"> <div class="mpdw-recent-img mb-1"> <img width="300" height="169" src="http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714118416.4067411-300x169.png" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" srcset="http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714118416.4067411-300x169.png 300w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714118416.4067411-1024x576.png 1024w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714118416.4067411-768x432.png 768w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714118416.4067411-1536x864.png 1536w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714118416.4067411.png 1600w" sizes="(max-width: 300px) 100vw, 300px" /> </div> </div> <div class="col-sm-8"> <div class="mpdw-recent-text"> <h4><a href="http://cyberiqcrew.com/index.php/3291/revolutionize-your-diy-projects-with-game-changing-microcomputers/">Revolutionize Your DIY Projects with Game-Changing..</a></h4> <span class="post-date">Apr 26, 2024</span> </div> </div> </div> </li> <li class="mpdw-recent-item mb-3"> <div class="row"> <div class="col-sm-4"> <div class="mpdw-recent-img mb-1"> <img width="300" height="169" src="http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714104018.307103-300x169.jpg" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" srcset="http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714104018.307103-300x169.jpg 300w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714104018.307103-1024x576.jpg 1024w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714104018.307103-768x432.jpg 768w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714104018.307103.jpg 1280w" sizes="(max-width: 300px) 100vw, 300px" /> </div> </div> <div class="col-sm-8"> <div class="mpdw-recent-text"> <h4><a href="http://cyberiqcrew.com/index.php/3285/unlocking-the-power-of-microcontrollers-for-diy-projects/">Unlocking the Power of Microcontrollers for..</a></h4> <span class="post-date">Apr 26, 2024</span> </div> </div> </div> </li> <li class="mpdw-recent-item mb-3"> <div class="row"> <div class="col-sm-4"> <div class="mpdw-recent-img mb-1"> <img width="300" height="157" src="http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714075230.2767298-300x157.jpg" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" srcset="http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714075230.2767298-300x157.jpg 300w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714075230.2767298-1024x536.jpg 1024w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714075230.2767298-768x402.jpg 768w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714075230.2767298.jpg 1200w" sizes="(max-width: 300px) 100vw, 300px" /> </div> </div> <div class="col-sm-8"> <div class="mpdw-recent-text"> <h4><a href="http://cyberiqcrew.com/index.php/3279/unveiling-the-secrets-to-unlocking-new-skills/">Unveiling the Secrets to Unlocking New..</a></h4> <span class="post-date">Apr 25, 2024</span> </div> </div> </div> </li> <li class="mpdw-recent-item mb-3"> <div class="row"> <div class="col-sm-4"> <div class="mpdw-recent-img mb-1"> <img width="300" height="169" src="http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714032012.2747679-300x169.jpg" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" srcset="http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714032012.2747679-300x169.jpg 300w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714032012.2747679-1024x576.jpg 1024w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714032012.2747679-768x432.jpg 768w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714032012.2747679.jpg 1280w" sizes="(max-width: 300px) 100vw, 300px" /> </div> </div> <div class="col-sm-8"> <div class="mpdw-recent-text"> <h4><a href="http://cyberiqcrew.com/index.php/3273/unveiling-the-latest-tech-marvels-innovations-beyond-imagination/">Unveiling the Latest Tech Marvels: Innovations..</a></h4> <span class="post-date">Apr 25, 2024</span> </div> </div> </div> </li> <li class="mpdw-recent-item mb-3"> <div class="row"> <div class="col-sm-4"> <div class="mpdw-recent-img mb-1"> <img width="300" height="192" src="http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714017612.701994-300x192.jpg" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" srcset="http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714017612.701994-300x192.jpg 300w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714017612.701994-1024x657.jpg 1024w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714017612.701994-768x493.jpg 768w, http://cyberiqcrew.com/wp-content/uploads/2024/04/p-upload-F1714017612.701994.jpg 1280w" sizes="(max-width: 300px) 100vw, 300px" /> </div> </div> <div class="col-sm-8"> <div class="mpdw-recent-text"> <h4><a href="http://cyberiqcrew.com/index.php/3269/revolutionizing-microcontrollers-a-new-era-in-hardware-tech/">Revolutionizing Microcontrollers: A New Era in..</a></h4> <span class="post-date">Apr 25, 2024</span> </div> </div> </div> </li> </ul> </section></aside><!-- #secondary --> </div> </div> </div> <footer id="colophon" class="site-footer pt-3 pb-3"> <div class="container"> <div class="info-news site-info text-center"> © 2024 <a href="http://cyberiqcrew.com/">CyberIQCrew</a> | <a href="http://cyberiqcrew.com/index.php/privacy-policy/">Privacy Policy</a> </div> </div><!-- .container --> </footer><!-- #colophon --> </div><!-- #page --> <script src="http://cyberiqcrew.com/wp-includes/js/imagesloaded.min.js?ver=5.0.0" id="imagesloaded-js"></script> <script src="http://cyberiqcrew.com/wp-includes/js/masonry.min.js?ver=4.2.2" id="masonry-js"></script> <script src="http://cyberiqcrew.com/wp-content/plugins/magical-posts-display/assets/js/venobox.min.js?ver=1.0.0" id="venobox-js-js"></script> <script src="http://cyberiqcrew.com/wp-content/plugins/magical-posts-display/assets/js/main.js?ver=1.2.36" id="mpd-main-js"></script> <script id="wp-statistics-tracker-js-extra"> var WP_Statistics_Tracker_Object = {"hitRequestUrl":"http:\/\/cyberiqcrew.com\/index.php\/wp-json\/wp-statistics\/v2\/hit?wp_statistics_hit_rest=yes&track_all=1¤t_page_type=post¤t_page_id=1699&search_query&page_uri=L2luZGV4LnBocC8xNjk5L2Jhc2gtc2NyaXB0LXJzcy1mZWVkLXJlYWRlci1zY3JpcHQv","keepOnlineRequestUrl":"http:\/\/cyberiqcrew.com\/index.php\/wp-json\/wp-statistics\/v2\/online?wp_statistics_hit_rest=yes&track_all=1¤t_page_type=post¤t_page_id=1699&search_query&page_uri=L2luZGV4LnBocC8xNjk5L2Jhc2gtc2NyaXB0LXJzcy1mZWVkLXJlYWRlci1zY3JpcHQv","option":{"dntEnabled":"1","cacheCompatibility":""}}; </script> <script src="http://cyberiqcrew.com/wp-content/plugins/wp-statistics/assets/js/tracker.js?ver=14.6.4" id="wp-statistics-tracker-js"></script> <script src="http://cyberiqcrew.com/wp-content/themes/affiliate-eye/assets/js/mobile-menu.js?ver=1.0.1" id="affiliate-eye-mobile-menu-js"></script> <script src="http://cyberiqcrew.com/wp-content/themes/affiliate-eye/assets/js/ticker.js?ver=1.2.1" id="jquery.ticker-js"></script> <script src="http://cyberiqcrew.com/wp-content/themes/affiliate-eye/assets/js/scripts.js?ver=1.0.1" id="affiliate-eye-scripts-js"></script> <script src="http://cyberiqcrew.com/wp-content/plugins/gallery-box/assets/js/isotope.pkgd.min.js?ver=2.5.1" id="isotope.pkgd-js"></script> <script src="http://cyberiqcrew.com/wp-content/plugins/gallery-box/assets/js/venobox.min.js?ver=2.5.1" id="venobox-js"></script> <script src="http://cyberiqcrew.com/wp-content/plugins/gallery-box/assets/js/slick.min.js?ver=2.5.1" id="slick.min-js"></script> <script type="text/javascript"> (function($) { "use strict"; $(document).ready(function() { $.scrollUp({ scrollName: 'clickTop', // Element ID scrollDistance: 300, // Distance from top/bottom before showing element (px) scrollFrom: 'top', // 'top' or 'bottom' scrollSpeed: 300, // Speed back to top (ms) easingType: 'linear', // Scroll to top easing (see http://easings.net/) animation: 'fade', // Fade, slide, none animationSpeed: 200, // Animation speed (ms) scrollText: '<i class=" fa fa-angle-double-up"></i>', // Text for element, can contain HTML activeOverlay: false, // Set CSS color to display scrollUp active point, e.g '#00FFFF' zIndex: 2147483647 // Z-Index for the overlay }); $('a#clickTop').addClass('hvr-bubble-top'); }); }(jQuery)); </script> </body> </html>