top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How comments are processed in shell script?

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?

posted Aug 18, 2015 by Chirag Gangdev

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Its just a convention i.e. #! (its not #, its #!) to tell what type of the shell/interpreter it is. Your scripts can be in bash, python, perl, ruby, PHP etc by the following means

answer Aug 18, 2015 by Salil Agrawal
Similar Questions
+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"
  echo "Invalid IP Address"

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

0 votes

I have a shell script present in my pendrive.
What i want is, Whenever i connect pendrive to my pc this script should be run automatically.

Is it possible?
If yes then how to achieve this?

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.