Array Every method in native javaScript

The Array every method of the Array prototype in native javaScript is a way to test if all elements in an array will meet a given condition or not. In the event that just one element in the array does not meet the condition, then the end result will be false. This method is then similar to that of the array some method that will return true if just one of the elements in the array will pass the test.

The array every method is then one of many built in array prototype methods that involve looping over the contents of an array to preform some kind of action like that of the array map method, or the array filter method when it comes to working with arrays in javaScript. Some might say that this method is a little redundant as there are methods like array for each method, or better yet a while loop, that can be used to easily accomplish the same task. However there are some things about it that help to make quicker work or creating a boolen value, and to do so in a standard way when it comes to the function that is given that will be called for each element.

Read More

Linux sleep command

The Linux sleep command can be used as a way to go about setting a delay between the execution of commands. This might prove to be useful when writing a bash script and I want to set a delay for each each time a loop is in effect as I can call it over and over again in the body of a while loop for example. So in this post I will be going over a few quick examples that involve using it in the command line, and also a few basic bash script examples where this kind of command will typically be used most of the time.

Read More

Linux uname command to find out info about the client OS

Todays post will be on the Linux uname command which can be used to gain some information about the client system that I am dealing with when working in a Linux or bash system that has the uname command to work with. This command should be there to work with in just about any posix system, but it might not be the best starting point to know what one is working with. Another command that one should look into would be the lsb_release command which should be there to work with in most of not all Linux Systems at least that will give more detailed info about the specific Linux Distribution that is being used.

When writing some kind of client system in which I can find out at least some details about what kind of OS my application is running on there may be a need to gain some additional details about that system. Often I can find out enough when it comes to certain built in modules of a given programing environment, but there should be ways of gaining more information if I know that I am dealing with a Linux system.

Also when it comes to writing bash scripts that I know will always run on a Linux system I will still want to know certain details about that system such as if a given command is there or not, and also things like what the version of the Linux kernel is. So in this post I will be going over just the basics of this uname command, there is not much to write about when it comes to the command itself, but there might be more to write about when it comes to some things that branch off from the uname command, as well as some alternatives.

Read More

Linux basename command to get just the file name of a path

When working out a bash script I might want to get just the base name of a path to a file or folder, one way to do so might be to use the linux cut command, but there is also the linux basename command that can be used for this task. The command works by passing a single argument to the command that should be a string value of a path to a file, the result that will be spit out to the standard output will then just be the base name of the path.

So then this basename command is a fairly basic command, but when it comes to writing bash scripts, or using it in conjunction with other scripts things might get a little confusing. So I thought I would write a quick post on this command, and also a few other commands that might end up being used in conjunction with it. Also there is making mentioning of some alternatives to using the basename command such as the linux cut command, and tools that there are to work with in programing environments such as the path module in nodejs that is also relevant to this sort of thing when it comes to a javaScript environment.

Read More

Linux pwd command, and other things path related

In Linux the pwd command can be used as one way to find out what the current working directly is in a command line interface. There are also a number of other ways to go about knowing this such as taking a look at the current state of a corresponding environment variable, or making use of a feature in a programing environment to do so. There is no just knowing what the current working directory is, but also how to go about changing what that directly is, with that said I have all ready wrote a quick post on the Linux cd command, however I think I should also wrte about that here also.

The pwd command is fairly simple, there is not a great deal to wrote about the command itself, but there might be a bit more to write about when it comes to all kinds of little things that might surround the use of the pwd command. So in order to keep this post from being to thin I think I am going to have to write a little bit about how to get the current working path in some various programing languages also, and any other various topics that might come up. One important thing that comes to mind is knowing the difference between absolute and relative paths when changing the current working path, and other little details such as how to change to a folder that has spaces in it which I remember was a brief time sucker when I was first leaning a thing or two about bash.

Read More