mirror of
https://github.com/onceupon/Bash-Oneliner
synced 2024-11-22 20:54:19 +00:00
add variable
get the length of variable
This commit is contained in:
parent
b310c4acbe
commit
430cfb08ef
1 changed files with 7 additions and 0 deletions
|
@ -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/,}
|
||||
|
|
Loading…
Reference in a new issue