Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
bashstringoperations [2016/01/28 12:18]
yassine chaouche
bashstringoperations [2016/01/28 12:19] (current)
yassine chaouche
Line 68: Line 68:
 root@messagerie-secours[10.10.10.20] ~ # root@messagerie-secours[10.10.10.20] ~ #
 </​code>​ </​code>​
 +
 == With the **:** == == With the **:** ==
 +So **f** here contains the service name prefixed with something like **S20** or **S19**. Let's say I want to get rid of the **3 letters** prefix, then I would use **"​${f:​3}"​**,​ like this :
 <​code>​ <​code>​
 root@messagerie-secours[10.10.10.20] ~ # while read -r f; do echo here is f : "​${f:​3}";​ done <<<"​$(ls -1 /​etc/​rc2.d/​)"​ root@messagerie-secours[10.10.10.20] ~ # while read -r f; do echo here is f : "​${f:​3}";​ done <<<"​$(ls -1 /​etc/​rc2.d/​)"​

QR Code
QR Code Extract part of a string using globs (generated for current page)