variablea="noyesno"
variableb=${variablea:2:3}
echo $variableb
this will pring "yes"
Skip first and last characters. Independent of string length:
variablea="xsomethingx"
variableb="${variablea:1:${#variablea}-2}"
echo $variableb
this will print "something"
No comments:
Post a Comment