Created
September 11, 2017 08:55
-
-
Save justdoit0823/59093996f27d09d8d32ec6d4936a3ce1 to your computer and use it in GitHub Desktop.
How to manipulate string in bash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# initialize string array | |
FILES=(aaa bbb ccc) | |
# retrive array's all elements | |
for file in `${FILES[@]}` | |
do | |
echo $file | |
done | |
# remove string's prefix | |
echo ${file#prefix} | |
# remove string's suffix | |
echo ${file%suffix} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment