Created
October 30, 2017 09:43
-
-
Save merin83/2107ee23060f5fdddaee4ec551dcf1a2 to your computer and use it in GitHub Desktop.
nth position string in bash ( the long way )
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
| read n | |
| text="" | |
| for ((i=0; i<n; i++)) | |
| do | |
| temp="" | |
| read input | |
| temp=${input:2:1} | |
| text=$text$temp | |
| done | |
| for ((i=0; i<n; i++)) | |
| do | |
| echo ${text:$i:1} | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment