 Okay, today we're going to be looking at scripts from Pastebin. I understand there's lots of different services like this out there, anytime you do a video like this, people are going to be like, oh, you should be using this service or that service. That's not the point of this video. The point of this video is to show you that if you find a script on Pastebin and you're having issues running it, this may be your problem. Let's have a look. So if you have other services you like rather than Pastebin, do comment below because the more people know about them, the more options we have, the better. But the point of this video is to show you, because this is a pain I wish Pastebin didn't work like this, which is one reason why you might want to use another service. Anyway, I have this script, very simple bash script. You have your shebang line, then we have two echo lines and a date command. If you go to that script and you click raw, you have the raw, the plain text. You can copy that and paste that into a file or let's try downloading the file. So I'm going to take the URL here, I'm going to say wget, I'm going to pass it that URL. And I'm going to say dash o and I'll call our script, script.sh. Of course, for it to run, we have to change mod plus x to make it executable, as always. At this point, .slash script should run it, right? No, we get errors. Let's look at it in vim. It looks fine. What is wrong with this? I have my shebang line, everything's spelt right, typed right, space is in the right place. Syntext, highlighting, everything looks right. We got hello world, hey buddy, date. Okay, let's save this and try running it again. No, we still got a problem that tells you right here, it's got a bad interpreter, bash, why would bash be the bad interpreter? Your problem is this right here. It's this little capital M. That is a carriage return. It's basically what indicates a new line in a text file. There's basically two main ways of doing this. There's the DOS or Windows way and then there's the Unix, Linux, assuming Mac OS way of doing it. Different carriage returns at the end. This is why if you type something up a script or something on Linux, it's a plain text file, you copy it over to Windows and you use notepad to open it, everything's all on one line because it doesn't recognize the carriage returns from the Unix or Linux type system. If you have a Windows script that you wrote in notepad and you bring it over here, it's not going to work. Now, certain editors, like if you use notepad plus plus on Windows or Vim here on Linux or whatever outbreaks you're running, they're smart enough to put in, it knows both returns and carriage returns, but the bash interpreter or the shell in your system, that's not going to know to use that. And there are ways to, I believe you spoke, but a quick and simple way to fix this is a tool called DOS to Unix. So we just do that, we give it the name of the file, boom. Now we open up in Vim, it looks exactly the same, but if we were to now run it, the script runs just fine. It just took all those returns, those carriage returns, and replaced them with the proper ones. And there's actually also a Unix to DOS, and look, there's a Unix to Mac, so maybe Mac does do something else. I don't know. So if you wanted to convert it back, you can by using that command. So that is the issue is just, you're trying to run the script, but the script's now looking and it's seeing these characters in there and it doesn't know what to do with them. So seeing it at the end, in that particular case, at the end of the shebang line, which has bash, it announces bash carat M, and it's like, well, I don't know what file that is. That's the issue. I really wish that Paceman didn't do this. I mean, look, it asks you what type of script it is. I mark it as a bash script, it highlights, syntax highlights as a bash script, it marks as a bash script. You would think that it would set it up so that the raw output for that would be with the Unix carriage returns. So I will now delete this file and also show you, we downloaded it and then convert it, but you can actually convert it while you're downloading it. So I can say output to the standard output, I'll also put a queue in here just for quiet so we don't get the download output. I'll pipe that right into DOS to Unix and then I'll redirect that into script.sh. And I thought I said quiet, but I guess, oh, I see what I did wrong. Yeah, let's remove everything in here. Yeah, that queue should have gone before that, oh, I don't know why I did that. Because O is looking for the file name and it thought we were giving it, yeah. Anyway, there. Now we don't get our messy output. There's our script. We can't run it yet because we haven't made it executable for security reasons. We've got to change mod plus x in the file name. Now it runs just fine. So you can download it, then run DOS to Unix on it or run DOS to Unix on it as it's downloading it and then save it to a file either way, make it executable and it works. So if you ever came across this, that's the issue and it's just because Pace been saving it with DOS carriage returns and it's just kind of annoying that they would do that. Again, I would understand if it was, you know, like a PowerShell script, but I mark it as bash, you should think that you're going to run it on a Unix-like system. Anyway, thanks for watching and I hope that you have a great day.