I am currently trying to get information about my file hosting accounts. As I keep a lot of my backup media on different accounts. I am using megatools to query information about the account, which I
Using awk to print all columns from the nth to the last
This line worked until I had whitespace in the second field.
svn status | grep '\!' | gawk '{print $2;}' > removedProjs
is there a way to have awk print everything in $2 or greater? ($3, $4.....
Bash sed awk, format CPU/Mem info from /proc/cpuinfo and /proc/meminfo
The problem that I'm trying to solve is to produce portable output that I can display on all of the servers in our environment to show basic info at login using generic information on all CentOS / ...
3 Ways to check CPU Cores in Linux - howtouselinux
In this blog post, we will discuss 3 different ways to check the number of cpu cores in Linux. This is useful information to have if you are trying to optimize your system for performance. Each method has its own advantages and disadvantages, so be sure to read through all of them before choosing the […]
Putting IP Address into bash variable. Is there a better way
I'm trying to find a short and robust way to put my IP address into a bash variable and was curious if there was an easier way to do this. This is how I am currently doing it:
ip=`ifconfig|xargs|...
I want to make big script on my Debian 7.3 ( something like translated and much more new user friendly enviroment ). I have a problem. I want to use only some of the informations that commands give...
For those who used apt-get, you know that everytime you install / uninstall something, you get the notificatons saying you need / no longer need certain dependencies.
I'm trying to understand the ...
Bash Recursion Examples and Experiments with Local Variables
Recursion in programming is when a piece of code (usually a function) calls itself. If there is no exit case, the program will go on forever. We will be discussing recursion in a bash script with examples and discussing some peculiarities of the bash shell, such as local variables. Setup Let’s make a shell script.…
I want to do a function that will return the factorial of a number in bash
Here's the current code that doesn't work, can anyone tell me what's wrong and how to correct it? I just started learning...
How can I convert my Bash script output to JSON and save it as “.json” file?
Here is my script:
Get System info
#!/bin/bash
readarray -t array <<< "$(df -h)"
var=$(echo "${array[1]}"| grep -aob '%' | grep -oE '[0-9]+')
echo "${array[3]:$...
Bash Array – How to Declare an Array of Strings in a Bash Script
Bash scripts give you a convenient way to automate command line tasks. With Bash, you can do many of the same things you would do in other scripting or programming languages. You can create and use variables, execute loops, use conditional logic, and store data in arrays. While
Bash doesn't have a strong type system. To allow type-like behavior, it uses attributes that can be set by a command. ‘declare’ is a bash built-in command that allows you to update attributes applied to variables within the scope of your shell. In addition, it can be used to declare a variable in longhand. Lastly, it allows you to peek into variables.