I'm writing a script in Unix where I have to check whether the first character in a string is "/" and if it is, branch.
For example, I have a string:
/some/directory/file
I want this to return 1, and:
[email protected]:/some/directory/file
to return 0.
There are many ways to do this. You could use wildcards in double brackets:
You can use substring expansion:
Or a regex: