Use of "seq" and "if" while creating Linux scripts
-
Hey guys, big shout out and thank you for fantastic job. I am using your Linux+ guide to study but I am actually scheduled to take my Linux Administrator Cert from the Linux Foundation. I will let you know how it goes. So far, the way they give the exam is VERY different than Comptia according to notes.
In CompTIA Linux+ (LX0-104) 9.2 video is taught about the seq function inside of a script. I could not replicate the script in Ubuntu 15. I was going crazy until I found this site that recommends not to use it for Bash version greater than 4.3
Also for the "if" command or function, it must carry brackets "[ ]", at least in Ubuntu 15.04 Bash 4.3.30
Just wanted to point that out.
Thank you and keep up the good work!
Fabian -
Greetings, Fabian! Thanks for the high praise of the show and we are very glad to hear that you are getting a lot out of it! Here's hoping that you do well on your exam :)
I found it curious that you were having trouble with Ubuntu 15.04 and the example scripts we used in the show. I checked out the link you posted and it does say that seq is an older command, but I was still convinced that they should work. I was able to get them to work on my Mint 17.2 machine and Don was using either CentOS 6.5 or 7. These are all current versions of their respective distros. I then thought it may be a problem with Ubuntu 15.04 specifically, so I downloaded it and tried the scripts there and they did work without any modification (e.g. it didn't require [] around if statements and scripts with the seq command returned no errors).
I thought that I might have a different version of bash, but a bash --version revealed 4.3.30. What might help is if you could post the errors that you are getting when trying to use our scripts and maybe that will point us in the right direction to what the problem may be.
Cheers,
Daniel
ITProTV
Show Host -
Thanks for the replay! Very interesting Daniel. I did not try seq with () as the site recommended. I literately copy paste the script and it didn't work. I will let you know.
Thank you!