To check whether the first character of a string is a slash or not, then you can use the conditional expression if [ "${string:0:1}" = "/" ]. The expression compares whether the first character is slash or not.