I have the following script to launch a MySQL process:if [ ${1:0:1} = '-' ]; then    set -- mysqld_safe $@fiif [ $1 = 'mysqld_safe' ]; then    DATADIR=/var/lib/mysql...What does 1:0:1 mean in this context?
Meaning of [ ${1:0:1} = '-' ]
linux;bash;shell
It's a test for a - dashed argument option, apparently. It's a little strange, really. It uses a non-standard bash expansion in an attempt to extract the first and only the first character from $1. The 0 is the head character index and the 1 is string length. In a [ test like that it might also be:[  -${1#?} =  $1 ]Neither comparison is particularly suited to test though, as it interprets - dashed arguments as well - which is why I use the leading space there. The best way to do this kind of thing - and the way it is usually done - is :case $1 in -*) mysqld_safe $@; esac