 The other day I came across this github page called Pure Bash Bible. It basically gives a bunch of examples on using bash without any external tools and there's a lot of good examples in there. And although I am not a bash purist where I feel the necessity to always just use the built-in functionality of bash, it does make your scripts a little more efficient if that's what you're going for. And I found a lot of these examples very interesting. So I'm gonna share some of them in some videos and today we're going to be looking at trimming white space from a string. So let's go ahead and jump over to the shell and I've already started creating a script here. It's called trim.sh. Here I create a string and it has some words in there with a bunch of white space and then we echo it out. Let's go ahead and just run this script and you can see it prints out that string with the white spaces. But if you want to remove all those excess white spaces only leaving the necessity of those those spaces between the words, there's a simple little function that I got from that pure bash Bible and let's go ahead and add that function in and it looks like this. Let's go ahead and fix the indentation. So you can see here we're going to trim all is the name of the function and then we're just going to pass it a string and it will return the string all trimmed up. So let's go ahead and just use that after our echo here. We're going to say trim all and we will pass it that string. So now our script should print that string like this with with the excess spaces and then it should print it with those all stripped away. So there we go and that is it. So again, I'll link to the website I got this script from or this function from that has a bunch of other functions the that github page and but yeah, it's pretty simple. It's just set some flags here and then prints it with those extra spaces removed and so you can throw this into any of your scripts and then call that function whenever you need to Re-trim away excess white space. I found this interesting thought. I would share visit films by chris comm. That's Chris the K There's a link in the description as always and don't forget my patreon page patreon.com forward slash metal x 1000 There's a link to that in the description as well. I would love your support If not think about liking sharing subscribing and commenting I thank you as always for watching and I hope that you have a great day you