[Solved] Linux ‘cut’ command line and replace
This should do the trick: #!/bin/bash INPUT=”$@” SIZE=${#INPUT} for ((i=0; i < ${SIZE}; i++)); do echo “${INPUT}” INPUT=”${INPUT:0:${i}} ${INPUT:$((i+1)):${SIZE}}” #INPUT=”$(echo “$INPUT” | sed “s/^\(.\{${i}\}\)./\1 /”)” done I added a sed option in the comment, although it creates a sub-process when you don’t really have to. 0 solved Linux ‘cut’ command line and replace