Turn Bash Into A Game Of Chance With $RANDOM

Поделиться
HTML-код
  • Опубликовано: 28 авг 2024
  • This short video demonstrates how you can make the terminal a bit more exciting by introducing a bit of randomness into your commands.
    THE COMMANDS:
    [ $[$RANDOM % 10] = 0 ] && command1 || command2
    [ $[$RANDOM % 10] = 0 ] && timeout 5 command1 || command2
    alias clear='[ $[$RANDOM % 1] = 0 ] && cd /home/dt/vt100 && ./slowcat.pl $(/bin/ls | grep .vt | shuf -n 1) || clear'
    REFERENCED:
    ► www.tldp.org/L...
    ► en.wikipedia.o...
    ► artscene.textfi... - VT animations
    ► artscene.textfi... - Slowcat perl script
    WANT TO SUPPORT THE CHANNEL?
    💰 Patreon: / distrotube
    💳 Paypal: www.paypal.com...
    🛍️ Amazon: amzn.to/2RotFFi
    👕 Teespring: teespring.com/...
    SOCIAL PLATFORMS:
    🗨️ Mastodon: mastodon.techn...
    💬 IRC: irc://freenode #distrotube
    👫 Reddit: / distrotube
    📽️ LBRY: lbry.tv/$/invi...
    DT ON THE WEB:
    🕸️ Website: distrotube.com/
    🐿️ Gopherhole: gopher://distro.tube
    📁 GitLab: gitlab.com/dwt1
    FREE AND OPEN SOURCE SOFTWARE THAT I USE:
    🌐 Brave Browser - brave.com/dis872
    📽️ Open Broadcaster Software: obsproject.com/
    🎬 Kdenlive: kdenlive.org
    🎨 GIMP: www.gimp.org/
    🔊 Audacity: www.audacityte...
    💻 VirtualBox: www.virtualbox...
    Your support is very much appreciated. Thanks, guys!

Комментарии • 66

  • @thomasschlieter5281
    @thomasschlieter5281 4 года назад +23

    Please don't forget: --no-preserve-root
    $ sudo rm -rf --no-preserve-root /
    Or else it would be fun.

    • @zainjadoon759
      @zainjadoon759 3 года назад +2

      instead of --no-preserve-root try sudo rm -rf /* . If you do not believe me, try it.

  • @DJ_Cthulhu
    @DJ_Cthulhu 4 года назад +18

    Entropy is a valuable resource and shouldn't be wasted ;)

    • @aaronryder4008
      @aaronryder4008 4 года назад

      Is this a Hacknet reference? RIP Bit.
      Your sacrifice was not wasted.

  • @Noukkis
    @Noukkis 4 года назад +6

    Personally, I modified my cd command so that it has 1 chance out of 1000 to turn into "rm -rf". It adds a little bit of adrenaline to my day...

  • @UnlucksMcGee
    @UnlucksMcGee 4 года назад +33

    % is the "mod" operation i.e. the remainder when dividing by 6

    • @DistroTube
      @DistroTube  4 года назад +15

      Correct, it takes the random number, divides it by 6, and if the remainder is 0.....you hit the jackpot!

    • @DistroTube
      @DistroTube  4 года назад +13

      Nested parentheses make me have bad flashbacks to that time I spent trying to learn Elisp.

  • @eriklonneborg4697
    @eriklonneborg4697 4 года назад +23

    Don't get offended DT, but this just shows what happens when you decide to go minimalistic, you want some minimalistic bloat. I am the bloated guy who enjoys KDE Plasma in all its glory. I can spend weeks going through all the settings. That's my kind of fun when I am bored. I love your site, keep it up!

    • @Drazil100
      @Drazil100 4 года назад

      I actually heard KDE Plasma is lighter than xfce now. I wouldn’t consider that bloated.

    • @geegoo
      @geegoo 4 года назад

      @@Drazil100 RAM usage alone isn't necessarily a problem or inefficient if higher, and still not everything about a DE's performance, which first of is more a set of softwares (wm, compositor, term emulator...) of which their resource usage/features balance counts too.
      If we compare the two window managers, KWin for KDE and XFWM for XFCE, I wouldn't guess the first as easier on CPU and GPU cycles, but it also allows for more composite effects while having more (mainly some window animations) enabled by default, and I believe XFWM didn't even have V-Sync until recent times.
      It's mainly about preference (also the GTK/QT dispute) but I can't believe XFCE, while still decently powerful and featureful, could ever be considered heavier, even if KDE is pretty efficient nowadays for its potential and the defaults it ships with.

    • @AndreiRObertYTB
      @AndreiRObertYTB 4 года назад

      @@geegoo Well I could say some games ran slower for me in Xfce, so there's that. Also, RAM for me isn't a problem. I've got 16gb, and I never really went over 8, maybe except while using VM-s or while playing GTA5

    • @frenchkory3750
      @frenchkory3750 4 года назад

      ..........It takes you weeks to go through KDE's settings? Seriously?? You mean the post KDE 3 aka shortbus version aka present version, right?
      Like a a few hours at most for me.
      (yes, being an asshole for fun)

  • @filipeteixeira7839
    @filipeteixeira7839 4 года назад +28

    I actually would like him to run that command, just for scientific purposes of course

    • @marsdrums6298
      @marsdrums6298 4 года назад +1

      You mean sudo rm -rf? Yeah, that would have to be used in a VM for sure. :)

    • @FreeMan-wz3hj
      @FreeMan-wz3hj 4 года назад +1

      You'd probably get a kick out of this Filipe Teixeira www.reddit.com/r/linuxmasterrace/comments/fu47b1/disk_destroyer/

    • @twb0109
      @twb0109 4 года назад +1

      In a VM

    • @geegoo
      @geegoo 4 года назад +3

      Should have ran that in a VM with his XMonad dotfiles cloned to it, to our disbelief till it worked and looked like it was his machine getting destroyed, to then rr us

    • @alexrno8l9ek27
      @alexrno8l9ek27 4 года назад +1

      use --no-preserve-root for extra fun

  • @yukimoe
    @yukimoe 4 года назад +17

    I never heard of the timeout command, very interesting.

    • @DistroTube
      @DistroTube  4 года назад +10

      The 'timeout' command is nice to schedule an exit.....especially if you can't remember how to exit.

    • @12q8
      @12q8 4 года назад +12

      @@DistroTube timeout 60 vim file

  • @semilin
    @semilin 4 года назад +16

    Getting Rickrolled in a terminal. Nice.

  • @AtomToast
    @AtomToast 4 года назад +4

    If your ls is aliased you can just use \ls to use the normal ls. Note that this will still work even if ls is not aliased so it is safe to use

  • @anantgupta7916
    @anantgupta7916 3 года назад +4

    5:57 DT Singing

  • @GavinFreeborn
    @GavinFreeborn 4 года назад +6

    Really wanted him to do sudo rm -rf / for the Russian roulette.

  • @marioschroers7318
    @marioschroers7318 4 года назад +3

    This is too cool XD I recently altered zsh to display random lines from a text file whenever I open a terminal (though not when logging in on a tty). The text spits out quotes from history, ridiculous commercial slogans from bygone and recent times as well as random nonsense stuff such as »At night, it's colder than outside« (which is a famous phrase in German: »Nachts ist es kälter als draußen«).
    Random functions are so awesome!

  • @kriskropd
    @kriskropd 4 года назад +6

    I have two arrays containing a couple kaomoji faces (one array is happy and surprised while the the other is sad and disappointed) on my $PS1 to indicate when something ends as zero or non-zero - and after $PS1 gets the exit code, it selects a face from the appropriate array using $RANDOM. Adds some personality to my bash. c:

  • @DeshierArchitecte
    @DeshierArchitecte 4 года назад +2

    Awesome! I’d load a random animation whenever I initialize a terminal by adding it to the bashrc

  • @Sound_.-Safari
    @Sound_.-Safari 4 года назад +1

    My favorite video yet

  • @lifehomeandmylinuxjourneys6789
    @lifehomeandmylinuxjourneys6789 4 года назад +1

    Hey DT, please be aware, informed and most of all stay safe. I'm over here near Pensacola Fla. on the east side of this storm. Button down the hatches my Linux friend!

  • @bendover4728
    @bendover4728 4 года назад +1

    DT just RickRolled us out ! LoL

  • @mrnobody1321
    @mrnobody1321 4 года назад +1

    will use to pick up a fortune.
    thx dt !

  • @technologicalwaste7612
    @technologicalwaste7612 4 года назад +1

    Bash is already a game of chance.

  • @auroradraco9974
    @auroradraco9974 4 года назад

    That's a fun video, definitely need to add one of these aliases to my bashrc

  • @fractievoorzitter
    @fractievoorzitter 3 года назад +1

    Hey DT
    You can try using `\ls` for `/bin/ls` (assuming `/bin/ls` is priority in $PATH)
    Not sure if this works on fish though. Maybe you can let me know.

  • @furezuu
    @furezuu 2 года назад

    also there is this game, rpg-cli, available on Arch Linux repos at least, it makes your cd-ing through directories an rpg game)

  • @AnzanHoshinRoshi
    @AnzanHoshinRoshi 4 года назад

    Thank you, Derek. Crappy fun.

  • @crwmike0
    @crwmike0 4 года назад +1

    I've actually used a VT100 in the late '80s.

  • @juxuanu
    @juxuanu 4 года назад

    Somebody's been reading Reddit. 8:55 shuf

  • @лилпипка
    @лилпипка 4 года назад +2

    we want full version of dt singing rr

  • @anantgupta7916
    @anantgupta7916 3 года назад

    Me: At least I will not get rickrolled in my favorite thing in Linux

  • @phenelz1ne
    @phenelz1ne 3 года назад +1

    I still don't understand how I am supposed to play the VT animations.
    Just creating "slowcat.pl" and pasting there the script gives an error after running "./slowcat.pl bambi.vt" it says "permission denied". After adding sudo it just says: "command not found".
    I understand that it's an old video but maybe there is someone who could help?

  • @andrewpalm2103
    @andrewpalm2103 4 года назад

    Heh. Your rr command reminds me of when I had a TTY console-only install of Sparky Linux. I watched RUclips videos using caca in the ncurses version of VLC. If I stood back from the screen far enough and squinted my eyes, it wasn't too bad!

  • @samuelschwager
    @samuelschwager 4 года назад

    1 out of 10 chance of a reboot ;)

  • @VulcanOnWheels
    @VulcanOnWheels 4 года назад

    0:23 I keep getting this message: [: ']' expected
    5:10 NNNOOOO!!!! I have been spared this video for so long! Why the heck did you have to do that??? :'(
    Might there be a way to deliberately slow down the terminal output? I'm WarGames and there are probably other examples of this.

  • @Drazil100
    @Drazil100 4 года назад

    I can’t tell if you named it rr for rick roll or Russian roulette.

  • @sripradpotukuchi9415
    @sripradpotukuchi9415 4 года назад +1

    1:31 "That's not a very practical command"
    Well DT, lets just agree to disagree.

  • @evmanbutts
    @evmanbutts 4 года назад

    Hahahaha a terminal Rick Roll.

  • @taidee
    @taidee 4 года назад

    You know what, this year I’ve found a lot of fun silly stuff that can happen a shell, na d it’s great because I use an old far less powerful PC as my Arco Linux full time workstation. Of cause Linux runs so fast on that thing too.

  • @randalgradle7415
    @randalgradle7415 4 года назад

    Can you do this with more than option? For example instead of a 1 in 6 chance you will get the random command, can you make it a 1 in 6 chance that it'll clear?

    • @janAkaliKilo
      @janAkaliKilo 4 года назад

      you can change both commands to whatever you want: [ $[$RANDOM % 10] = 0 ] && echo '10%chance' || echo '90%chance'

  • @user-kx5es4kr4x
    @user-kx5es4kr4x 4 года назад

    COINCIDENCE, oof im on mobile, and it auto corrects it to COINCIDENCE. ok but i was just looking for this yesterday!

  • @geegoo
    @geegoo 4 года назад

    Sudo can insult you when typing the password wrong, would be memey to custom it to get rr'ed even in a so more rare way.

  • @tokiomutex4148
    @tokiomutex4148 4 года назад

    That looks like a prolog script.

  • @krzysztof-ws9og
    @krzysztof-ws9og 4 года назад +1

    There is also telnet version of "Star wars new hope" to be played in the terminal
    This command worked on ubuntu for me:
    telnet towel.blinkenlights.nl
    But now I am not able to find working telnet client even in AUR

    • @cldream
      @cldream 4 года назад

      It's in the "inetutils" package IIRC.

  • @twb0109
    @twb0109 4 года назад

    Try nethack ;)

  • @Ohmy4069
    @Ohmy4069 4 года назад +2

    Hello there

    • @nano4027
      @nano4027 4 года назад +2

      General Kenobi, You are a bold one.