Can't properly express how grateful I am for this series. Would love if you ever felt inclined to do a more advanced + longer course on networking, server management, and security, would GLADLY pay for that.
I thought that Jay was awesome when I started watching this bash series. Now I KNOW that Jay is awesome! I'm thrilled to be learning here and am inspired with many new programming ideas. Thank you Jay!
this is kind of helpful code to let you understand it more counter=0 while [ $counter -le 10 ] do echo "$counter * 7 = $(( $counter * 7 ))" counter=$(( counter+1 )) done
Hi. Can you explain the subshell a bit in detail? How come you used $(date) What is the main reasoning and is this the only way to get the date command in this particular example? Thanks.
myvar=$(($myvar+1)) This part is rather unclear to me. Usually you can set a number to a variable without using a $ before the number but here you have to start with a $-sign. It is not explained why. Clearly the outer () are for the first $-sign (scope) but why do you have to put the $myvar+1 inbetween ()?
Hey, thanks for asking this, completely overlooked it. But when I went back trying to understand it, I found the reason. The $myvar+1 is an expression and per the syntax described in the manual for expr or in the earlier videos, you'd need to use expr to let bash know that you are attempting to perform an arithmetic operation. Using () around it, negates the use of expr. Check out the manual of expr for more details!
If I understand right the myvar=$( ) - mean that the "myvar" equal use the value of the result of the variable in the ( ) and additional ( ) to just to replace typing of "expr" command, that is why $(( ))
Did anyone else have an issue with their results not printing out? The script ran like it was meant to but the numbers didn't appear where they were suppose to, as in there were lines of results with no numbers occupying them.
Am I the only one who's never found a real world use for while loops? At least one where it's actually the best way to do something. Most of the time it's better to use a for loop because for loops are easier to control and are more readable.
In Python you often use it to purposely induce an infinite loop and assign a break when a certain condition is met - in other words, keep doing this thing forever until x happens. This is often used for example if you prompt the user for input, but only allow them to break from the prompt if the input meets certain conditions, which you can check with for example regex. Unsure how that would work with a for loop.
@@faanross yeah, but that's getting fancy with user input. I really meant while loops in bash. You almost never need them and they're hard to control. When I do user input I just have command line arguments, so the program can be scripted even if it's just something simple.
@@wheezybackports6444 I’m brand new to bash scripting but I was wondering if a while loop could be useful for waiting for something to finish executing/downloading/loading then once it is finished, to do something else? Or maybe you create a script that flags when a certain user is online and pings you whenever they go offline?
You're leaving important concepts unexplained while explaining simple things over and over :( For e.g. Why we have to use subshell and (( to override a variable?
Can't properly express how grateful I am for this series. Would love if you ever felt inclined to do a more advanced + longer course on networking, server management, and security, would GLADLY pay for that.
One of the best channels here on UA-cam , i'll give you that.
I thought that Jay was awesome when I started watching this bash series. Now I KNOW that Jay is awesome! I'm thrilled to be learning here and am inspired with many new programming ideas. Thank you Jay!
This series is amazing and has helped me understand many concepts easily. He is an awesome teacher. Thanks so much for creating this wonderful content
I love the fact of the small assignment at the end of this lesson 😊 I just made my small math quiz with while loops and it worked perfectly!
Please please do an intermediate/advanced tutorial for instance while loop with arithmetic functions and conditions 😢 you're such a good teacher!
This is a great series packed with tons of great examples.
Love the series! Love your channel! Thank you!
Great video! Thank you so much!
this is kind of helpful code to let you understand it more
counter=0
while [ $counter -le 10 ]
do
echo "$counter * 7 = $(( $counter * 7 ))"
counter=$(( counter+1 ))
done
Tnx captain❤😊
Hi. Can you explain the subshell a bit in detail? How come you used $(date)
What is the main reasoning and is this the only way to get the date command in this particular example?
Thanks.
You might have added that CTRL-C will stop a runaway loop. 🙂
It’s choice
But removing the file is making sense
thank you LOL
Ain't that obvious? And also that would have defeated the point of the infinite while loops.
Hello, how do you loop also the echo for The file no longer exists.?
great videos thanks bro
myvar=$(($myvar+1))
This part is rather unclear to me. Usually you can set a number to a variable without using a $ before the number but here you have to start with a $-sign. It is not explained why. Clearly the outer () are for the first $-sign (scope) but why do you have to put the $myvar+1 inbetween ()?
Hey, thanks for asking this, completely overlooked it. But when I went back trying to understand it, I found the reason. The $myvar+1 is an expression and per the syntax described in the manual for expr or in the earlier videos, you'd need to use expr to let bash know that you are attempting to perform an arithmetic operation. Using () around it, negates the use of expr.
Check out the manual of expr for more details!
In other words, both work , the extra parenthesis remove the need for the expr command:
myvar=$(expr $myvar + 1)
myvar=$(($myvar + 1))
@@alissonreinaldosilva1119 This myvar=$(expr $myvar + 1) does not work, I tried
@@spasha90 it works)
If I understand right the myvar=$( ) - mean that the "myvar" equal use the value of the result of the variable in the ( ) and additional ( ) to just to replace typing of "expr" command, that is why $(( ))
Did anyone else have an issue with their results not printing out? The script ran like it was meant to but the numbers didn't appear where they were suppose to, as in there were lines of results with no numbers occupying them.
For me it just ran 1's without adding, script copied in verbatim
The videos are great but can you please to slow down more? Some of us don't understand English fast as others XD
Under Settings icon, you can reduce the speed of the video playback if that helps
fr? my first language is not English and i can understand it very easily
thank you
good video
Thanks
Thank you !!
cool video)
You are the best
👍Thanks!
learned while loop
in if-else video, you forget to explain about else-if statements.
☯🙏
Am I the only one who's never found a real world use for while loops? At least one where it's actually the best way to do something. Most of the time it's better to use a for loop because for loops are easier to control and are more readable.
In Python you often use it to purposely induce an infinite loop and assign a break when a certain condition is met - in other words, keep doing this thing forever until x happens. This is often used for example if you prompt the user for input, but only allow them to break from the prompt if the input meets certain conditions, which you can check with for example regex. Unsure how that would work with a for loop.
while True:
# Code
if :
break
# Code
@@faanross yeah, but that's getting fancy with user input. I really meant while loops in bash. You almost never need them and they're hard to control. When I do user input I just have command line arguments, so the program can be scripted even if it's just something simple.
@@wheezybackports6444
I’m brand new to bash scripting but I was wondering if a while loop could be useful for waiting for something to finish executing/downloading/loading then once it is finished, to do something else?
Or maybe you create a script that flags when a certain user is online and pings you whenever they go offline?
@@GoogleAccount-ki1ww You can use an until loop for that too if you wanted.
You're leaving important concepts unexplained while explaining simple things over and over :(
For e.g. Why we have to use subshell and (( to override a variable?