GCC Linux C compiler and C language hello world programs

The Linux gcc command is a C language complier that is right there to work with if one wants to get into C programing in a Linux system. I took a moment to start playing around with it, and just have some fun with a few quick, basic, C language hello world programs.

I am very much a javaScript developer, and as such I have been shying away from C for a long time. There is much about the language that strikes me as being very intense and time consuming. In javaScipt I like having things going on like garbage collection, and dynamic typing. Sure javaScript is like riding a bike with training wheels, but it is still very much a bike that will take me places. I have this mindset that what matters most in programing are things that are independent of language. Regardless if a program is written in javaScript, C, or even something like qBasic what does the program do? Why would I or anyone else want to use it? The answers to those questions are what matter first and for most to me.

However getting back to the topic at hand. I want to start experimenting with at least a few languages outside of javaScript, I still like the language a lot, it is still my preferred language by far, however I want to expand at least a little way into some other languages. With that said C has been on my scope for a long time, and I thought that it could not hurt to work out at least a few quick hello world C examples that I would then build using the Linux gcc command. So lets get to it then.

Read More

Parameters in Linux Bash Scripts

When writing a bash script in Linux there might come a time where I might want to pass one or more arguments for a script. With that said there is starting out with positional parameters, but it is important to refer to positional parameters as such. That is because parameters can refer to a number of things in bash scripts other than just simple basic positional parameters.

There is knowing how to access arguments for a call of a script, and there is also knowing how to find out how many arguments where given when the script was called in total. There is also doing something for all arguments that are given like how the Linux cat command works when giving file names as arguments. So on top of positional parameters there are also a number of special parameters for tasks such as getting all the parameters, and the count of parameters.

There is also the bash command itself, and any arguments that might be based to the bash command before the script or command that is called. So then there is yet another set of parameters or arguments to be aware of. In addition there is also parsing the positional arguments into a form that can be described as named parameters. That is making a script that will except arguments in a similar way to that of many of the Linux commands that one might be familiar with.

So then in this post I will be going over some bash script examples where I am going over each of the kinds of parameters to be aware of.

Read More

Linux chmod command, file permissions and bash scripts

The Linux chmod command is the tool that is used to set file access permissions in a Linux system, along with most other POSIX systems for that matter. The chmod command can be used with other commands such as ls -l to find out what the current state is with permissions, and do something to change that state.

The chmod command also comes into play when it comes to making a bash script, or any script execute without having to call the command to do so first. When working out a script for automating work there is placing a shebang at the top of the file to let Linux know what binary needs to be used to run the script. However in order to make use of it the script needs to become executable first, and one way to do that is by using the Linux chmod command.

Read More

Linux Bash Script While loop examples

I think I will write at least a few posts on the Linux bash command shell. This is a very complex topic in Linux compared to much of my other Linux content thus far on commands such as echo where there is only so much to write about.
Anyway when it comes to using bash there is not just learning how to manually enter a command or two, there is also learning how to write bash scripts, making them executable, and having them be part of a startup script, or a process of some kind. There is much to write about when it comes to this topic, but in this post I am just going to focus on while loops in Linux Bash.

While loops strike me as one thing that comes to mind when it comes to learning a new language. On top of that in order to learn a thing or two about while loops with bash I am also going to need to pick up a thing or two about other aspects of bash scripts such as how to create an expression, and how to create shell variables. So while writing a thing or tow about while loops a few other topics should also come up in the process of doing so.

Read More

Linux Build Bash Script JavaScript Style

The Linux cat command is a way to concatenate two or more files into a single body that is then spit out to the standard output. In the event that no files are given then the standard input is what is used in place of a file. The cat command is also often used as a command for just opening up a file and displaying the content of that file in the standard output. The cat command like all other Linux commands can then also be used in conjunction with a whole host of other commands via piping. A single file can also be created from a whole bunch of other files also, by making use of redirection or piping to a program that will act as a way to save the result to a file.

Like many otherLiunux command such as echo this is one of several basic commands that come up when it comes to getting a better understanding of how to work in a Linux and bash environment. So it make sense to create a quick post on this command with a few examples of why it is that this command is so useful in manly little cases.

Read More