Technology Blog by Ajit

IP address validation in linux/bash

Finding an IP address is valid or not.


In Linux 5, instead of finding IP is valid or not thru script, we can just execute a command to find. This helps to decrease number of lines we write to find its validity.

If you provide correct IP, the return code will be zero. If a not-a-valid IP provided, then the return value will be 1

# ipcalc -c 10.10.10.10
# echo $?
0

# ipcalc -c 10.10.10.1011
ipcalc: bad IPv4 address: 10.10.10.1011
# echo $?
1
Newer Post Older Post Home

Blog Archive

  • ►  2021 (1)
    • ►  August (1)
  • ▼  2020 (22)
    • ▼  July (22)
      • Uploading image thru Docker in OCI
      • OCI - Manual creation of Instance from scratch
      • To prefix zero in front of digits
      • SDP tnsnames.ora entry for 2 node rack
      • Changing password in non-interactive
      • IP address validation in linux/bash
      • First time passwordless ssh setup without manually...
      • man-in-the-middle ssh issue
      • LFI-01518: write error
      • How to avoid Blob corruption
      • Check emkey is copied to the repository
      • Mail/sendmail activation in Linux
      • Missing id_rsa file
      • Changing owership of a Listener
      • Connecting OVMM to EMCC
      • Re-configuring SDP IPs
      • Setting up and destroying passwordless ssh to sun ...
      • End to end configuration of SDP listener
      • ORA-16649 with Observer
      • Scripting oracle wallet creation - mkstore
      • Unable to start observer due to DGM-16979 in oracl...
      • DGM-16979 in oracle 11g

Labels

  • Database
  • Exadata
  • Exalogic
  • OCI
  • Scripting
  • Storage

Report Abuse

View Ajit Solomon's profile on LinkedIn
Powered By Blogger

Search This Blog

Theme images by centauria. Powered by Blogger.