Thanks for the video, very nice introduction to scripting! I really enjoy you showing the mistakes and little of how you think while solving them.
@DistroTube5 жыл бұрын
Thanks, Wagner!
@user-gi2mn5yf5j5 жыл бұрын
You had me at Dmenu scripting I am totally into that. So I used to script a lot to get the most out of my text based mud game without cheating. Since I quit playing games I have missed scripting a lot. I don't know much about bash scripts but this is a breath of fresh air :)
@arkansawdave74285 жыл бұрын
Haha. I've watched about 25 seconds of this and YES, it exactly what I've been wondering. I like using a terminal and have been doing it for years but I have no real idea how scripting works. Perfect. Thanks.
@med50325 жыл бұрын
> /bin/ls -d.... you have an alias with ls. you can run unaliased ls with \ls like you would escape a space or quote. > & & and ; and && all behave differently; so, use them wisely. ``` false; echo "yes" # prints "yes" true; echo "yes" # prints "yes" false && echo "yes" # does not echo true && echo "yes" # prints "yes" ``` & does everything asynchronously. > ' (single quotes) " (double quotes) are the same. no, single quotes will not evaluate your variables. double quotes will. (I think there is something else that will be evaluated using double quotes.)
@ndanielamaha56182 жыл бұрын
Thank you DT. I'm new to bash and I need to learn it for Bioinformatics and this has been a wonderful introduction to the world of bash.
@arminmatthes3 жыл бұрын
Your reasoning for using the options variable was to avoid having to come in and change a bunch of stuff whenever the directories or files have changed, yet this is exactly what you'll have to do because of your if-statements whenever the number of directories is not equal to 6. A better way of doing this would be to simply check whether or not a subdirectory with the name of $choice exists in $myDir and then open emacs at that location: if [ -d "${myDir}${choice}" ]; then exec emacsclient -c "${myDir}${choice}" else echo "No such directory" fi
5 жыл бұрын
You are definitely not "on the safe side" by using #!/usr/bin/bash instead of the more normal #!/bin/bash. Also, if you write your scripts POSIX compliant, which you should, use #!/bin/sh. That's being on the safe side.
@davidh.49443 жыл бұрын
Umm, _why_ should you make your scripts posix compliant? If you have bash, use bash, and take advantage of all of its advanced features. That's what the shebang is there for-to tell the system which interpreter to use when executing the script. There's no need to hobble yourself with the limited syntax of posix unless your script needs to be completely portable across multiple, unknown platforms. I don't know why people always make such a fuss about posix compliance and portability, when most scripts are written to solve a specific task on a specific machine, with an environment the writer knows about. Besides, you will only very rarely find a linux system, at least, that doesn't have bash installed. And if you are the type of person who finds himself frequently porting scripts around, you're probably also the kind of person who knows what to do if it isn't. And finally, even posix scripts can't be safely run on unfamiliar hardware without at least a cursory check of the available commands and file paths.
@andrewa32162 жыл бұрын
Did you watch the video? He literally did a whereis bash to find out exactly where it is first. He never made it seem like that 100% would always work. What he DID say would always work was /usr/bin/env
@AnzanHoshinRoshi5 жыл бұрын
Thank you, Derek. It's always good to see bourne again shell testifying.
@chreshcat2 жыл бұрын
Thanks Derek, your video prompted me do some self teaching (which I presume was the aim of the video). Thought I'd share the feedback so you keep your video's coming. Cheers
@JonDoe-gi5zf Жыл бұрын
Just got my first Linux cert, your videos were really helpful. 🙏
@seraph_86 Жыл бұрын
Thank you DT i added this to autostart nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
@ViniciusProvenzano5 жыл бұрын
Hi, I see you are into Arcolinux. I love it, and I’d like to see more content on it from you. Great video!
@ishanagarwal4755 жыл бұрын
Acrolinux is a themed archlinux with an installer it saves u some time in not learning how to write your own config ... It is not that different from arch whatever goes for arch goes for arcolinux too..
@ViniciusProvenzano5 жыл бұрын
@@ishanagarwal475 You're right. I've already installed Arch, and created my configs. But Arcolinux is the easiest way to get Arch running with some sane configurations. I think that the approach to the problem can be different to achieve the same result. You can go with Arch and install what you need and keep all tidy and minimal, or you can go with Arco and just uninstall most of the stuff you will not use. I think it is interesting that I manages to work very well with both approaches, but when I tried to so a similar path with Manjaro, I just got crazy. By the way, you can install ArcolinuxD, and have a very functional bare minimum Arch installation, in under 10 minutes. From there you can configure as you wish... Take a look here: kzbin.info/www/bejne/fF6pcmiprLWcjpY
@joetheman744 жыл бұрын
For GUI text editors Kate is fantastic. BTW every time I hear shebang I think of William Hung. How many people remember and know what I am talking about.
@anonpoliticallyincorrect97214 жыл бұрын
Thank you, I was looking for a video like this!
@andrewpalm21035 жыл бұрын
Good info, Derek. I'm going to look into using rofi in a similar fashion.
@__-wv1my5 жыл бұрын
.fr ? Parlez-vous français ? Cool, je ne savais pas. Merci pour la video, c'est très instructif !
@alexandrosvangelatos99793 жыл бұрын
Great video, used it to launch of pdf files I have for label printing. Thanks
@sys7emH4cked Жыл бұрын
Very helpful tutorial thanks D.T for making this useful contents. 👉👍👈
@themagicrabbit18775 жыл бұрын
Any text editor? Can I use Microsoft Notepad?
@DistroTube5 жыл бұрын
Yes, you can.
@themagicrabbit18775 жыл бұрын
@@DistroTube YES!!! Now I just need to figure out how to get it installed on Arch...
@themagicrabbit18775 жыл бұрын
@Farouk Mokhtari Oh really? I did not know that. The joke is on me now I suppose. I don't even use notepad at work anymore due to it's lack of syntax highlighting.
@popespalace8235 жыл бұрын
Yeah use wine haha 🍷
@themagicrabbit18775 жыл бұрын
@Svein Are Karlsen Actually, Notepad got support for Unix line endings in May 2018. It's still one of the least impressive text editors around though.
@spidertube10005 жыл бұрын
Derek you're my hero
@90hijacked5 жыл бұрын
איזה יופי, אני לא לבד פה
@benpit50122 жыл бұрын
Dd if= of=/dev & &( Ampersand) at the of a line gets command run in background so u dont have to wait for dd to finish Thanks for all your words of wisdom help advice guidance etc.
@sheikhshakilakhtar68445 жыл бұрын
Hello, thanks for the video. Would you mind doing a tutorial on configuring xterm? I have come across quite a few on urxvt, but not anything useful on xterm.
@DistroTube5 жыл бұрын
The configuration for xterm is similar to urxvt: you use the .Xresources file.
@sippstea54535 жыл бұрын
Learnt something today.
@devon6605 жыл бұрын
Before you run your shell scripts always lint them with shellcheck! There are a lot of pitfalls when writing shell scripts.
@sch88365 жыл бұрын
Been meaning to learn bash scripting but was just too lazy. But now that DT has uploaded it, I will get to learn it.
@DaveSomething5 жыл бұрын
I've /bin/bashing the keyboard! lame, I know... not as bad as shebang! sudo apt purge sudo
@toosafelol5 жыл бұрын
After that just use su and then reinstall sudo
@piotrarturklos5 жыл бұрын
This is awesome, very clear. And you've picked an example project which is a good one for bash, where calling terminal commands is really important to avoid cruft and boilerplate. If you can make another episode, a more technical one with quirks of bash syntax, that would be like a good next step and also very interesting to me personally.
@laarags2 жыл бұрын
Thanks for sharing 👍
@urugulu16565 жыл бұрын
im using shellscripts for finding and converting audiofiles around and then removing the source (find in all its glory together with ffmpeg in its respective glory is just to much for me to remember and execute on a day to day basis). btw i spotted csgo footage on your machine is there anything to expect
@DistroTube5 жыл бұрын
Old videos. I haven't played CSGO probably in a year.
@santoshgujar52372 жыл бұрын
Thank you, Sir
@bahathir_5 жыл бұрын
In GNU Emacs GUI, we can resize the font with C-x C-+ #Increse font's size C-x C-- # Decrease font's size Thank you.
@loarto5 жыл бұрын
You can usually increase the font in the terminal. st f.ex. uses ctrl+shift+{page up, page down}. problem with using terminal, is that emacs don't control how text is displayed. The terminal does. GUI and terminal are very different.
@yiannifunataoldotcom3 жыл бұрын
Hey!! I d love to see how we could check if choice was in the list and if so just use choice to launch dired
@juanpmarinr5 жыл бұрын
What WM are you currently using ?
@DistroTube5 жыл бұрын
Xmonad in this video.
@stylianoslayranos68815 жыл бұрын
Thank you for uploading another quality video.
@DistroTube5 жыл бұрын
Thanks! :D
@maxpolaris992 жыл бұрын
& is put in background, why do you want to start these programs in the background?
@kellingc4 жыл бұрын
The & shovesd the comman into the background. So "sleep 3 &" creats a job in the background and 3 seconds later. If you use the jobs command, this will show all the background jobs that running.
@robertmarder1265 жыл бұрын
Just FYI, for your shebang line, it's always better to not reference the path directly, so you don't run into the situation you showed here with /bin/bash verses /usr/bin/bash (or even /usr/local/bin/bash as is common on the BSD's) #!/usr/bin/env bash /usr/bin/env is so commonly used that no distro dares move it anywhere else. Of course, what would be even better, is to make your scripts POSIX compliant. Then you can just use #!/bin/sh without worrying what the particular shell is.
@md.imamulislam75 жыл бұрын
Someone running non-POSIX-compliant shell like FISH will run into problems if we leave the shebang line.
@robertmarder1265 жыл бұрын
@@md.imamulislam7 every unix-like system I have ever seen uses a POSIX-compliant shell for /bin/sh regardless of what the user's personal shell is.
@SuperCape5 жыл бұрын
How did you get transparent background in Emacs? I WANT IT 😭
@RoKishDubbz5 жыл бұрын
Install a compositor, such as compton. And tweak it up to add transparency
@kevinklement26215 жыл бұрын
Great video, but I'm the annoying guy who has to point out that "ampersign" is not a word. The word you're looking for is "ampersand".
@DistroTube5 жыл бұрын
Hmm. If I add it as an entry to Urban Dictionary, does it become a real word? :D
@kevinklement26215 жыл бұрын
@@DistroTube Yes, but you'll have to come up with a much dirtier meaning.
@kentjensen45045 жыл бұрын
This is so cool.
@shwaybotx3 жыл бұрын
Back in the day when you made this useful video you never looked at the camera. This is weird. We'd like you to look at us sometimes! I think your later videos improve on this point.
@stereo1232 жыл бұрын
Did you create Bobby's world?
@danielyount98125 жыл бұрын
Good gist of bash shell scripting with Emacs. Still use the g(vim) here. Had never jumped into emacs. It does have some cool options.
@tlotlooepeng87213 ай бұрын
a single "&" means run this in the background while && is "and". so what happened is you ran the first 3 lines in the background then ran geany
@kentkou18725 жыл бұрын
I know you are demostrating the if else condition controls. But at the end 'if else' does not make sense as you are doing exactly the same thing with selected directory names. why not just do this: exec emacsclent -c ${myDir}${choice} Script will be much shoter and cleaner.
@DistroTube5 жыл бұрын
I hope to do another video continuing where I left off with this script, since I didn't really make the script do what I originally wanted. And yes, choice will be a part of that video if/when I get to it.
@artadams13 жыл бұрын
Friends don't let friends use EMACS
@elisium82425 жыл бұрын
How i can run my script one time on startup? (I'm on debian stretch)
@DistroTube5 жыл бұрын
Will vary depending on what desktop or window manger you run. There is a way to autostart programs in every desktop. Google the solution for what you are running.
@harrytsang15015 жыл бұрын
Sounds like you would like a systemd service. Search "Create A Custom Systemd Service" for more details. Once created, enable it to run on startup. If you want to interact with your script at some point, you can use a tmux session to house the process. e.g. ExecStart=tmux new-session -s SessionName ScriptFile ExecStop=tmux kill-session -t SessionName Then you can use `tmux attach -t SessionName` to interact. Once you are done simply press "Ctrl-B" followed by "D" to detach
@jeff-kj3pb5 жыл бұрын
you could add a line in your ~/.xinitrc file with the line: ./myscript.sh &
@DaveSomething5 жыл бұрын
speaking of bash... I did write a nifty .bash_profile that gives me information about a system when I login via SSH. things like space on a particular drive, the temp of the cpu, heh I even added the weather in that area.
@DistroTube5 жыл бұрын
Nice!
@Broly_15 жыл бұрын
I really want to learn but man it is not easy as it look.
@linuxterm76225 жыл бұрын
Right when I was learning bash
@arcanelore168 Жыл бұрын
Easy!
@_yuri5 жыл бұрын
henlo
@hademvids4 жыл бұрын
Text editor? No, no, no, no, no... echo “~~~” >> .txt
@denisde4ev4 жыл бұрын
no, no... cat >> .txt
@natemaia92375 жыл бұрын
you forgot 'fi'
@cam22915 жыл бұрын
TLDW: step 1: install gentoo
@ciatronic59045 жыл бұрын
what does tldr mean? talk less draw more?
@cam22915 жыл бұрын
@@ciatronic5904 oops it's tldw fixed it
@linuxrant2 жыл бұрын
micro!
@Cyanwasserstoff5 жыл бұрын
The coding feels similar, I am no expert so please excuse my question, but is it possible that the bash is using C++ or a similar programming language ?
@jeetadityachatterjee69954 жыл бұрын
Bash is written in c (like most gnu projects) there maybe some pass through
@davidh.49443 жыл бұрын
Bash syntax is bash syntax. But the underlying base decends from the original bourne shell and the posix standard, with a good number of other features "borrowed" from ksh, and zsh, and other sources. Cross-pollination is very common among scripting and programming languages, and you'll find that a lot of them have taken a hefty dose of inspiration from C-family syntax. Not really surprising, since so much of the underlying infrastructure is written in it.
@caremyok5 жыл бұрын
mmmm
@scifregizmoguy5 жыл бұрын
I love you're channel, DT, but this video was painful to watch. Maybe you should have planned a little better.
@RM-ff1lm5 жыл бұрын
I disagree. I gained a lot of knowledge from this video.
@scifregizmoguy5 жыл бұрын
@@RM-ff1lm It does have a lot of information. I'm referring to the delivery, and the many mistakes he made which could have been misleading for a noob. Misinformation is worse than lack of information. He didn't even know why his scripts were failing.
@RM-ff1lm5 жыл бұрын
@@scifregizmoguy I'm sure he did most of that on purpose because he was showing how to correct the problems you run into when you create your own scripts. I wish I had this video when I first started scripting because I had no idea how to fix my mistakes.
@scifregizmoguy5 жыл бұрын
@@RM-ff1lm Fair enough
@hoobsug5 жыл бұрын
shouldve stopped listing editors after mentioning geany. electron based editors must die
@pepeshopping5 жыл бұрын
Wow... “Teaching” scripting and “not expecting that to happen”. What exactly did you expect from launching the command sleep to the background?? (Hint: It returns immediately!). Find a better teacher...
@BreakTheBeat8525 жыл бұрын
Damn dude chill out he’s just trying to teach us some useful stuff, everyone makes mistakes. I’m guessing you weren’t always as tech savvy as you are now