Shell Scripting - If & If/else

Поділитися
Вставка
  • Опубліковано 3 гру 2024

КОМЕНТАРІ • 66

  • @TaiKibris
    @TaiKibris 6 років тому +12

    your doing a great job at breaking down each topic! thank you

  • @fmj_556
    @fmj_556 4 роки тому +3

    It's very hard to find the absolute basics in one place. Thanks for making these videos!!!

  • @RawApeFromAlbion
    @RawApeFromAlbion Рік тому

    This simple video helped me finish something far beyond more complicated. Thanks for the tips on spacing etc., it's what helped me finish.

  • @ChillerDragon
    @ChillerDragon 6 років тому +32

    There Is no need for semicolon if newline Is used. Because newline and ; have a pretty similar effect in bash.
    Both ways are correct:
    If [ condition ]; then
    If [ condition ]
    then

    • @ko-Daegu
      @ko-Daegu 6 років тому

      ChillerDragon
      Thankx for the info

    • @unbekannter_Nutzer
      @unbekannter_Nutzer 11 місяців тому +1

      Both are incorrect, since you need a blank before and after `cond`.

    • @ChillerDragon
      @ChillerDragon 11 місяців тому

      @@unbekannter_Nutzer yes of course fixed my comment thanks

    • @iteachcyber5713
      @iteachcyber5713 11 місяців тому

      Isnt it true that you can also use: if [[ $VARIABLE == "1" ]]; then
      echo​ "hi"
      fi @ChillerDragon

    • @unbekannter_Nutzer
      @unbekannter_Nutzer 11 місяців тому

      @@iteachcyber5713 Instead of what? And why do you quote the 1?

  • @Tksupreme
    @Tksupreme 8 місяців тому

    amazing tutorial that finally helped me understand this concept after struggling with man pages and overly complicated blogs

  • @ajeetdev
    @ajeetdev 3 роки тому

    You are my fav teacher , I learn a lots of things from your videos.
    Keeping doing this.
    Lots of love from india

  • @Agjmdpu
    @Agjmdpu 5 років тому +3

    Very informative. But you missed the nested part of if else conditions.

  • @01andy17
    @01andy17 4 роки тому

    Good job mate. Ive just started a course on udemy suppose to be for complete beginners, which i am. Unfortunately the guy isn't explaining things very well for a complete beginner. I'm really enjoying the slow pace and how you explain things.

  • @vicyoslinuxofficial2607
    @vicyoslinuxofficial2607 4 роки тому

    4:22 Hahahahaha. This part was funny. 😂😂😂😂😂
    Thank you so much for the video. :)

  • @theglobalconflict6904
    @theglobalconflict6904 4 роки тому

    Yes :) you're right nano is easy and simple

  • @jumpu123
    @jumpu123 6 років тому +1

    Great work Alexis!

  • @Stressed_PhD_0831
    @Stressed_PhD_0831 3 роки тому

    Thanks for these intro videos. Much appreciated!

  • @MrGFYne1337357
    @MrGFYne1337357 6 років тому +1

    Hsploit my hacker guru, you rock man!

  • @somecatyoudontknow6471
    @somecatyoudontknow6471 2 роки тому

    This helped a lot. Thank you.

  • @bara7979
    @bara7979 2 роки тому

    Starts at 2:28

  • @sarundayo
    @sarundayo 5 років тому +1

    Amazing series!

  • @unbekannter_Nutzer
    @unbekannter_Nutzer 11 місяців тому

    @3:35 5 errors in 5 lines of code?
    1. The space after `if`is NOT optional.
    2,3. single square brackets need spaces after opening and before closing, so it would be `if [ condition ]`.
    4. The semicolon at the end of the line is superfluous, since it is a replacement for a newline, mostly used interactively.
    5. The body of the if-statement is not a condition, but one or more statements.
    Later: You should not use ALLUPPERCASE for your shell variables, but have them reserved for the system. (Only a recommendation, not an error).
    You needn't mask "Alexis" with quotes, since it does not contain blanks or something else, which needs to be quoted. Quotation marks aren't markers for strings. Using them is again not an error, but it leads newcomers to the wrong assumption, that they are similar to other programming languages. They are not. The same is true for `echo Welcome Alexis`. Here you HAVE a blank, but echo will put a blank between any two parameters by itself. Just if you happen to use 2 or more blanks, you need quotation to preserve them.
    @8:35 `read` has an option for prompting: `read -p "Please enter your name " name` (note the trailing space in the quote). You don't ask for the username, because that is already known and it is $USER.
    @11:40 AI is going wild! No, the password file (/etc/passwd) does not contain the hashed passwords, /etc/shadow does.
    And you can't unhash them, that's the purpose of hashing them. Instead, the token the user uses to login is hashed by the same algorithm and if the hashing of his input matches the entry in /etc/shadow, he is let in.

  • @1jeffhead
    @1jeffhead 5 років тому +1

    You're great, thank you.

  • @jazy1
    @jazy1 6 років тому +1

    Love your vids 💖

  • @elviraeloramilosic9813
    @elviraeloramilosic9813 6 років тому +2

    Thank you!

  • @refaiabdeen5943
    @refaiabdeen5943 Рік тому

    Cheers Mate.

  • @Gr33n37
    @Gr33n37 6 років тому +1

    thank you bro, its awesome

  • @lukaspodvojsky7246
    @lukaspodvojsky7246 6 років тому +1

    Awesome tutorials, keep it up please ;).

  • @muhammed6007
    @muhammed6007 3 роки тому

    Such a tutorial. Great job man:)

  • @fratquintero
    @fratquintero Рік тому

    [5:25] That is not true. The space is needed in order for the shell interpreter to recognize correctly the "=" operator. No assignment can´t be made inside the [[ command

  • @anonymousgerman2809
    @anonymousgerman2809 2 роки тому

    Thankyou so much

  • @brankobanjac9322
    @brankobanjac9322 Рік тому

    Great video

  • @top_movies2023sf
    @top_movies2023sf 10 місяців тому

    Awesome ❤

  • @kelvinowusu9987
    @kelvinowusu9987 6 років тому

    Does the variable we are checking need to have quotes?

  • @AmeerHamza-jy5ml
    @AmeerHamza-jy5ml 4 роки тому

    Sir only unary operators can work in "if condition" ?
    How we can use binary operators like (=) in if statement ?

  • @babatundefasheun5126
    @babatundefasheun5126 4 роки тому

    How do you calculate 3^2 in using NASM? I have not been able to find a good explanation. Have you got a video you can share?

    • @unbekannter_Nutzer
      @unbekannter_Nutzer 11 місяців тому

      I don't know for NASM, but in bash, it is ((3**2)).

  • @somnathgolui2912
    @somnathgolui2912 4 роки тому

    Thank You
    Thanks a lot....................... for this.......

  • @whitedavil9463
    @whitedavil9463 4 роки тому

    thanks

  • @YannMetalhead
    @YannMetalhead 2 роки тому

    Good video.

  • @asmodeus4310
    @asmodeus4310 3 роки тому

    Hey hackersploit, is there an elif statement in bash. If not, how to do that???

  • @medicineman7894
    @medicineman7894 2 роки тому

    This is great

  • @F0R3STHiGHTS
    @F0R3STHiGHTS 4 роки тому

    thx bro

  • @wentaoqiu4072
    @wentaoqiu4072 4 роки тому

    He uses 'condition' when he means 'statement' after if.

  • @JKTPila
    @JKTPila 6 років тому

    It's a nice tutorial

  • @pratikdigraskar
    @pratikdigraskar 3 роки тому

    In my windows this code is not running what to do

  • @ajeetdev
    @ajeetdev 3 роки тому

    Sir in my system not working showing some errors
    Command not found

  • @neophyte88
    @neophyte88 6 років тому

    Hey man ..I am getting a error when I run the script
    It asks for input and then says "syntax error: unexpected end of file"

  • @syscreeper4376
    @syscreeper4376 2 роки тому

    elliot be like : Hello Friend

  • @arnavjain7564
    @arnavjain7564 6 років тому

    Is there an else if in bash?

    • @ChillerDragon
      @ChillerDragon 6 років тому

      Arnav Jain yes its called elif

    • @HackerSploit
      @HackerSploit  6 років тому

      Yes, i will be covering that next.

  • @ronakrawal8325
    @ronakrawal8325 6 років тому

    Please teach us how to make hacking scripts in python

  • @bucketice300
    @bucketice300 Рік тому

    are you now 45 ?

  • @joshibhumit156
    @joshibhumit156 6 років тому

    Ha moj ha

  • @subodhkamble6480
    @subodhkamble6480 6 років тому +1

    26th ❤️

  • @pauljojo831
    @pauljojo831 6 років тому

    epic

  • @hp143007
    @hp143007 6 років тому +1

    First one!

  • @kl14cdk74
    @kl14cdk74 6 років тому

    🃏🃏🃏🃏🃏🃏🃏🃏🃏🃏🃏🃏🃏🃏🃏🃏

  • @pauljojo831
    @pauljojo831 6 років тому

    pls look at your email.

  • @ravindraprajapati468
    @ravindraprajapati468 6 років тому

    999

  • @mesut96
    @mesut96 2 роки тому

    Thank you so much for this video