Hi all,
I was doing some bash scripting a little while ago and while manipulating some text using some neat shortcuts I thought I'd share
in case anyone has a need to do just this;
Consider a variable; `string="this is a string"`
To output this string as is, you'd do this;
```
$ echo $string
this is a string
```
If you wanted that string to output all uppercase, you could do this;
```
$ echo ${string^^}
THIS IS A STRING
```
If you wanted that string to output all lowercase, you could do this;
```
$ echo ${string,,}
this is a string
```
If you wanted to capitalise just the first word, you could do this;
```
$ echo ${string^}
This is a string
```
If you wanted to capitalise every word, you could do this;
```
$ stringArray=( $string )
$ echo ${stringArray[@]^}
This Is A String
```
If you wanted to change a the word `is` to another word, say `isn't` then you could do this;
```
$ echo "${string// is/ isn\'t}"
this isn't a string
```
If you wanted to change all the spaces into underscores, you could do this;
```
$ echo "${string// /_}"
this_is_a_string
```
I hope that this will help someone =)
---
|14Best regards,
|11Ch|03rist|11ia|15n |11a|03ka |11Me|03aTLoT|11io|15N // @meatlotion:erb.pw
|07ÄÄ |08[|10eml|08] |
15ml@erb.pw |07ÄÄ |08[|10web|08] |15www.erb.pw |07ÄÄÄ¿ |07ÄÄ |08[|09fsx|08] |1521:1/158 |07ÄÄ |08[|11tqw|08] |151337:1/101 |07ÂÄÄÙ |07ÄÄ |08[|12rtn|08] |1580:774/81 |07ÄÂ |08[|14fdn|08] |152:250/5 |07ÄÄÄÙ
|07ÄÄ |08[|10ark|08] |1510:104/2 |07ÄÙ
--- Mystic BBS v1.12 A48 2022/07/15 (Linux/64)
* Origin: thE qUAntUm wOrmhOlE, rAmsgAtE, uK. bbs.erb.pw (1337:1/101)