User Tools

Site Tools


bash:how_to:start

Differences

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

Link to this comparison view

bash:how_to:start [2018/08/02 22:52]
Rob Stroess
— (current)
Line 1: Line 1:
-===== bash: "How To"===== 
-^operation^what^code^example using:\\ export TST='abcabcaa'^result from\\ abcabcaa^ 
-|remove|first occurence of substring '__xyz__' in string|STR=${STR/'__xyz__'}|echo ${TST/'bc'}|aabcaa| 
-|:::|substring '__xyz__' everywhere in string|STR=${STR%%//%%'__xyz__'}|echo ${TST%%//%%'bc'}|aaaa| 
-|:::|substring '__xyz__' at very beginning of string|STR=${STR#'__xyz__'}|echo ${TST#'abca'}|bcaa| 
-|:::|substring '__xyz__' at very end of string|STR=${STR/%__xyz__}|echo ${TST%'bcaa'}|abca| 
-|:::|first __n__ characters|STR=${STR:__n__}|echo ${TST:2}|cabcaa| 
-|:::|last __n__ characters|STR=${STR:-__n__}|echo ${TST::-3}|abcab| 
-|extract|all characters after (!) position __n__\\ //(first char position: __n__=0)//|STR=${STR:__n__}|echo ${TST:1}|bcabcaa| 
-|:::|__m__ characters after (!) position __n__|STR=${STR:__n__:__m__}|echo ${TST:1:5}|bcabc| 
-|:::|characters after (!) position __n__ until end of string minus __m__|STR=${STR:__n__:-__m__}|echo ${TST:1:-1}|bcabca| 
- 
  

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War

Impressum Datenschutz