Archivo por meses: agosto 2013

Bash String Comparison: Find Out IF a Variable Contains a Substring

http://www.cyberciti.biz/faq/bash-find-out-if-variable-contains-substring/   How do I determine whether a variable called spath=»/srv/www/cyberciti.biz/https» contains a substring called «cyberciti.biz»? You can use the portable BourneShell syntax as follows: case «$var» in *pattern1* ) echo «do something #1»;; *pattern2* ) echo «do something # 2»;; * ) echo «Error…»;; esac Here is a sample code: #!/bin/bash spath=»/srv/www/cyberciti.biz/https» sync_root(){ echo… Leer más »