top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to identify with in the script about the count of parameters passed to a given shell script?

+1 vote
284 views
How to identify with in the script about the count of parameters passed to a given shell script?
posted Feb 4, 2016 by Mohammed Hussain

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
0 votes

I have noticed that in shell script comments are also useful to perform some task,
for ex:
if i write #!/bin/bash/
or if i write #!/bin/sh/

in both the example script behavior is different,
both are comments then why it is giving different behavior?

+2 votes

I am using below script to validate IPV6 address but this script also pass invalid IP such as empty string, name etc.

if [[ "$IPv6ADDR"=~"^:?([a-fA-F0-9]{1,4}(:|.)?){0,8}(:|::)?([a-fA-F0-9]{1,4}(:|.)?){0,8}$" ]]; then
  echo "valid ipv6 addr"
  break;
else
  echo "Invalid IP Address"
  break;
fi

Can someone identify what's wrong in the regex, Please?

...