Bash script to loop through values in a file with space as a separator

Lets say we have a file with list of IPs that are space separated and you want to read each of the values to pass to a loop to perform an operation. Here is an example file with IP Addresses separated  by a space:

cat ips.txt
192.168.1.1 192.168.1.10

Now, lets say you want to loop through these IPs and run a ping command against each of them.

cat ping.sh
#!/bin/bash

# IFS is an internal bash variable. Here, we set its value as space.
IFS=$" "
# Read the file "ips.txt" and store the list of values to a variable "ips"
ips="$(cat ips.txt)"

# Run the following loop which will loop through each of the ips and run a ping test
for ip in $ips; do ping -c 1 $ip; done
# Unset the IFS variable so that it wont mess with the reset of the script
unset IFS

-Running this loop, will loop through the list of IP addresses and perform a ping.

./ping.sh
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.660 ms

--- 192.168.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.660/0.660/0.660/0.000 ms
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
64 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=0.108 ms

--- 192.168.1.10 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.108/0.108/0.108/0.000 ms

Hope this helps!

Happy scripting folks! 🙂

Source/References: Link

How to fix chrome update loop “Nearly up-to-date! Relaunch Google Chrome to finish updating. Relaunch”

This is a guide on how to fix chrome update loop message “Nearly up-to-date! Relaunch Google Chrome to finish updating. Relaunch

Current version: 49.0.2623.39 dev-m (64-bit)

To verify open chrome and check the version in “About” page and then check if you get the above message with a Relaunch button. Then, recheck your chrome version in “About” page and see if it gives the same message.

check chrome about

Relaunch Google Chrome to finish updating error

 

 

If its still giving you the error message “Nearly up-to-date! Relaunch Google Chrome to finish updating. Relaunch”, then you can follow these steps to resolve this issue:

[IMPORTANT: Please  backup all your chrome bookmarks and other chrome related data before attempting this troubleshooting just to be on the safe side.]

Step 1. Close all active chrome windows

Open task manger to check if there are any instance of chrome running.

If you are on Windows 8 / Windows 8.1 machine, Press CTRL+ALT+DEL together in your keyboard, and click  “Task Manager“.

Now, you will find chrome in the list, right click that and select “End Task” for any process that says “Google Chrome”.

end task for all chrome

 

Step 2. Delete old chrome’s executable and folder

Now, Browse to the following folder:
C:\Program Files (x86)\Google\Chrome\Application\

You will see two executable files there: chrome and new_chrome

file location C:\Program Files (x86)\Google\Chrome\Application\

Right click on chrome and select “Delete“.

delete chrome.exe

Now, rename executable file “new_chrome” to “chrome“. So after renaming it will look like this:

rename new_chrome to chrome

Now, Delete the folder with the older version number. In my case, I deleted the folder “49.0.2623.39“.

delete old chrome folder 49.0.2623.39

Step 3. Verify chrome version

Open up your chrome browser. Check the “About

check chrome about

 

chrome update error fixed

It should now display the message “Google Chrome is up to date.”

And Voila! You have successfully fixed the update issue.

If this article helped you, then support us by leaving a comment down below or by liking us on FacebookTwitterGoogle+ and Tumbler.

Regards,
ΞXΤЯ3МΞ

Source: Link