<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>bash on Notities</title><link>https://www.vandenboom.icu/en/tags/bash/</link><description>Recent content in bash on Notities</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Thu, 18 Jul 2024 07:20:59 +0000</lastBuildDate><atom:link href="https://www.vandenboom.icu/en/tags/bash/index.xml" rel="self" type="application/rss+xml"/><item><title>Find the name of your USB stick with a script</title><link>https://www.vandenboom.icu/en/blog/2024-zoek-de-naam-van-je-usb-stick-met-een-script/</link><pubDate>Thu, 18 Jul 2024 07:20:59 +0000</pubDate><guid>https://www.vandenboom.icu/en/blog/2024-zoek-de-naam-van-je-usb-stick-met-een-script/</guid><description>You can use this script to retrieve the name of your USB stick.
The name of your USB stick can be used in Apple&amp;rsquo;s sudo command to create a USB installer.
Step 1: Open the Terminal application
Step 2: Go to your home directory, type: # cd
Step 3: Optionally create a scripts directory, type: # mkdir scripts
Step 4: Navigate to the newly created scripts directory, type: # cd scripts</description></item><item><title>Bash script with a SUCCESS or FAILED message at the end of the line</title><link>https://www.vandenboom.icu/en/blog/2024-bash-script-met-een-succes-of-failed-melding-aan-het-einde-van-de-regel/</link><pubDate>Wed, 31 Jan 2024 20:18:39 +0000</pubDate><guid>https://www.vandenboom.icu/en/blog/2024-bash-script-met-een-succes-of-failed-melding-aan-het-einde-van-de-regel/</guid><description>See below an example script to display a SUCCESS message in green or a FAILED message in red, right-aligned at the end of the line.
#!/bin/bash # Set the message success_message=&amp;#34;Your command was successful&amp;#34; failed_message=&amp;#34;Your command failed&amp;#34; # Set the &amp;#34;OK&amp;#34; string in green ok=&amp;#34;$(tput setaf 2)[SUCCES]$(tput sgr0)&amp;#34; failed=&amp;#34;$(tput setaf 1)[FAILED]$(tput sgr0)&amp;#34; # Get the width of the terminal term_width=$(tput cols)+9 # Calculate the number of dots needed success_dots_count=$((term_width - ${#success_message} - ${#ok})) failed_dots_count=$((term_width - ${#failed_message} - ${#failed})) # Create a string of dots for success and failed messages success_dots=$(printf &amp;#34;%0.</description></item></channel></rss>