how to manipulate string in script?
for example:
if a string str ="abcde",and now I want get first 4 characters out from the string, how should I do? |
bash only way:
Code:
${str:0:4} Code:
expr "$str" : '\(.\{4\}\)' |
Another portable method:
echo asdfgh|cut -c1-4 asdf |
All times are GMT -5. The time now is 05:34 PM. |