From 430cfb08eff98a14b8f9a709086f51bd40986d3f Mon Sep 17 00:00:00 2001 From: onceupon Date: Tue, 10 Apr 2018 14:57:51 +0800 Subject: [PATCH] add variable get the length of variable --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 936baee..4feddff 100644 --- a/README.md +++ b/README.md @@ -826,6 +826,13 @@ for line in $(cat myfile); do echo $line; read -n1; done #'bar' # double/single quotes around single quotes make the inner single quotes expand variables ``` +##### get the length of variable +```bash +var="some string" +echo ${#var} +# 11 +``` + ##### replacement (e.g. replace 'a' with ',') ```bash {i/a/,}